Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The collector object takes your API key pair as an access key and secret key value, as we configured previously. This will allow it to communicate directly with the simple analytics collector configured by BlinkMobile, for your project. It will also take the URL of the analytics service you wish to communicate with (again, this will be the URL we set up in the previous step).

Code Block
languagejs
// Initialise the Analytics collector object

const collector = new Analytics({
  accessKey: ANALYTICS_ACCESS_KEY,
  secretKey: ANALYTICS_SECRET_KEY,
  origin: ANALYTICS_URL
})


We set up our collector by initialising a new Analytics object, and passing it the values we configured in the previous step. This custom collector will now be able to communicate directly with the collector in your dashboard, via the access key and secret key.


Next up, we'll look at how you format and log a custom event.

Next Step


Formatting and Logging Events