Analytics Integration

Accelerate tracks page views, sessions, and engagement automatically — for many sites that's all you need. The client-side API is there when you want to go further: tracking custom interactions, attaching your own attributes, or recording metrics specific to your product.

Everything lives under the global Altis.Analytics object on the front end.

Setup functions#

Use Altis.Analytics.onReady( callback <function> ) to ensure analytics has loaded before making other calls:

text
Altis.Analytics.onReady(() => {
  // Safe to call record(), updateEndpoint(), etc.
})

Tracking functions#

Use Altis.Analytics.record( eventType <string> [, data <object>] ) to record a custom event.

The optional data object can include attributes and metrics:

text
Altis.Analytics.record('videoPlay', {
  attributes: {
    videoTitle: 'Product tour'
  },
  metrics: {
    secondsWatched: 42
  }
})

Attributes and metrics can be used later in custom queries — including through the AI Integration abilities.

Endpoint functions#

In Accelerate, an endpoint is the visitor's browser or device.

Use Altis.Analytics.updateEndpoint( data <object> ) to update the data associated with the current endpoint. This is the key to custom audience targeting: any attribute you set here becomes available for segmentation. Use Altis.Analytics.getEndpoint() to read the current endpoint data back.

Accelerate automatically collects and updates some endpoint data, including:

  • UTM parameters: utm_campaign, utm_source, utm_content, utm_medium, and utm_term.
  • Operating system.
  • Device brand.
  • Browser.
  • Location, country, and region.
  • Number of page views.
  • Number of sessions.

Updated endpoint data is merged into new event records associated with the endpoint.

Default attributes and metrics#

To attach a value to every event automatically, register it once instead of passing it on each record() call:

  • Altis.Analytics.registerAttribute( name <string>, value <string | callback> ) — adds an attribute to all recorded events. The value can be a function, called at record time.
  • Altis.Analytics.registerMetric( name <string>, value <number | callback> ) — the same, for numeric metrics.

Audience functions#

  • Altis.Analytics.getAudiences() — returns the audience IDs the current visitor matches. Useful for coordinating your own scripts with Accelerate targeting.
  • Altis.Analytics.on( event, callback ) / Altis.Analytics.off( ... ) — listen for analytics lifecycle events, such as when audiences change.

For targeting logged-in users with backend data, see Personalization for Logged-in Users.