Data API

Fanplayr's data API is a simple javascript array which can be used to store and send information to the Fanplayr Platform. It can be used alongside the standard Fanplayr integration to track additional information in your store.

Note: The array must be defined and populated with values BEFORE the standard User Tracking snippet is executed.

Examples

Tracking additional page properties

In the following example, two additional properties named brand and color are captured along with the standard information Fanplayr tracks for page views.

The special _type property informs Fanplayr that the information should be stored with the page view.

<!-- Before user tracking snippet -->
<script>
window.fanplayr_api = [{
  "_type": "page.data",
  "brand": "Super",
  "color": "red"
}];
</script>

Page tracking callback

The following example defines a Javascript callback to be invoked by Fanplayr whenever it tracks a page view.

This mechanism could be used to implement special logic in the browser that reacts as users fall into predefined segments. E.g. Open a third-party chat widget when users fall into a specific Fanplayr segment.

<!-- Before user tracking snippet -->
<script>
window.fanplayr_api = [{
  "_type": "onPageView",
  "callback": function (event) {
    // Called after Fanplayr tracks each page view.
    // `event.segments` is an array of any segment tags the user fell into for the tracked page.
  }
}];
</script>

results matching ""

    No results matching ""