Analytics.js for Platforms

The ecosystem of marketing and analytics tools is growing insanely fast, and most web platforms face tons of requests from their customers to build new destinations. But adding more destinations is hard: it requires thinking about how each one needs to work, the use cases for different customers, what data needs to be collected and where it needs to be sent. As the number of destination grows, the complexity of maintenance increases as well.

Analytics.js for Platforms gives web platforms four destinations out of the box: Google Analytics, Google Adwords, Facebook Ads and Segment. The first three cover 99% of destination needs for most small businesses, while Segment gives an escape valve to another 200+ destinations for advanced customers.

If you have questions or want to talk to our partnerships team, email partners@segment.com.

Setup

To load Analytics.js for Platforms, include this snippet on your page and initialize with the customer-specific destination settings.

Initializing takes two arguments, both optional but at least one required:

  • writeKey — the customer’s Segment write key, found on the Settings → API Keys page in their Segment account. If the customer does not have a Segment write key, pass null or an empty string

  • settings — an object containing a map of destination name to settings for that destination, detailed below. destination Settings

Each destination has a set of required and optional settings that change how it functions

Google Analytics

Settings

Example

Adwords

Settings

Example

Facebook Pixel

Settings

Example


If you have any questions or see anywhere we can improve our documentation, please let us know or kick off a conversation in the Segment Community!