Custom Analytics API#

We send the data about all interactions in a project to your Google Analytics property by default. In addition to that, you can add other analytics trackers and specify which events will be sent to them using their API calls.

Add custom tracker

Follow the instructions of an analytics service of your choice to obtain its tracking code. Usually, the code should be placed into the <head> section.

See Code Embedding

Set up API calls to track events

The global object RM.customAnalyticsHandlers contains two arrays:

  1. RM.customAnalyticsHandlers.event — the array of functions that handle the events on pages. Each time a visitor triggers an event on a page all the functions in this array are executed.
  2. RM.customAnalyticsHandlers.track — the array of functions that handle transitions between pages. Each time a visitor goes to another a page in a project all the functions in this array are executed.

Functions that you add to the arrays are called with an object containing tracking parameters in a format that Google Analytics accepts. Modify the object according to specifications of your analytics tool and send it using its API call.

Sample code


Let’s say, we are using Kissmetrics in addition to Google Analytics.
Here’s a piece of code that sends data to my Kissmetrics account each time visitors submit a form on the page ‘/5’:

In addition, I would like to track visits to the pages ‘/contact’ and ‘/buy’:

List of events#

Below is the list of actions that we track by default. A sample of an argument for the functions — ’params’ object — is provided below each event.

Page view

Add functions to ‘track’ array.

{ "page": "/dps/556542", "location": "", "screenName": "Test" }

Clicks on external links

{ "hitType": "event", "eventCategory": "Project Actions", "eventAction": "External Link", "eventLabel": "", "page": "/dps/556542", "location": "", "screenName": "Test" }

Clicks on anchor links

{ "hitType": "event", "eventCategory": "Project Actions", "eventAction": "Anchor Link", "eventLabel": 652, "page": "/dps/556542", "location": "", "screenName": "Test" }

Clicks on ‘scroll top’ links

{ "hitType": "event", "eventCategory": "Project Actions", "eventAction": "Scroll Top Link", "page": "/dps/556542", "location": "", "screenName": "Test" }

Form is submitted

{ "hitType": "event", "eventCategory": "Project Actions", "eventAction": "Form Submit Click", "page": "/dps/556542/page-url", "location": "", "screenName": "Test" }

Clicks on ‘go back’ links

{ "hitType": "event", "eventCategory": "Project Actions", "eventAction": "Back Link", "page": "/dps/556542/page-url", "location": "", "screenName": "Test" }

Hotspot hovers

{ "hitType": "event", "eventCategory": "Project Actions", "eventAction": "Hotspot Hover", "page": "/dps/556542/page-url", "location": "", "screenName": "Test" }

Hotspot clicks

{ "hitType": "event", "eventCategory": "Project Actions", "eventAction": "Hotspot Click", "page": "/dps/556542/page-url", "location": "", "screenName": "Test" }

Video starts playing

{ "hitType": "event", "eventCategory": "Project Actions", "eventAction": "Video Play", "eventLabel": "Readymag — Product Video /", "page": "/dps/556542/page-url", "location": "", "screenName": "Test" }

Video stops playing

{ "hitType": "event", "eventCategory": "Project Actions", "eventAction": "Video Pause", "eventLabel": "Readymag — Product Video /", "eventValue": 4, "page": "/dps/556542/page-url", "location": "", "screenName": "Test" }