Segmentation as a Service

Fanplayr's Segmentation as a Service is a JavaScript API that emits events with information about segments your users fall into. You can listen to these events to implement custom actions when users fall into specific segments.

This is used in addition to the standard Fanplayr integration.

Callback Template

The following snippet is used to listen to segmentation as a service events after Fanplayr tracks each page.

<!-- 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>

Example: Third-party chat widget

This mechanism could be used to implement custom logic that opens a third-party chat service when users fall into predefined segments.

<!-- Before user tracking snippet -->
<script>
window.fanplayr_api = [{
  "_type": "onPageView",
  "callback": function (event) {
    if (event.segments.indexOf('High-Value-Customer') !== -1) {
      olark('api.chat.sendMessageToVisitor', {
        body: "Questions? We'd love to chat."
      });
    }
  }
}];
</script>

results matching ""

    No results matching ""