module-data-analyticstracker

3rd party tracker usage

This manual is meant for 3rd party marketing websites only and explains the basic usage of the Infinitaslearning data analyticstracker as embedded script.

Usage

Getting started

<script src="./scripts/mdat.js"></script>

or from the Content Delivery Network (CDN)

example: <script src="https://yw5hbhl0awnz.noordhoff.nl/tracker/mdat.js"></script> OpCo specific: yw5hbhl0awnz.noordhoff.nl yw5hbhl0awnz.plantyn.com yw5hbhl0awnz.liber.se

This makes the tracker available on the global variable named mdat.

Initialize the package

Place the following code snippet on your page to initialize the tracker:

<script> mdat.initialize({ platform: '<platform name>', // we'll provide the value that you'll need to use platformVariant: '<platform variant>', // we'll provide the value that you'll need to use (if applicable) platformVersion: '1.2.3', // version of your application, optional environment: 'production', // use one of 'local', 'acceptance', 'production' opCo: 'noordhoff', // the Infinitaslearning operating company the site is for (noordhoff, liber or plantyn) }); </script>

You can place the script in either head or body, but make sure mdat.initialize has been called before doing any tracking.

Track events

Events can only be tracked in the body of your page.

Page event

The most important event to track is the page event:

<script> mdat.page({ category: 'local', // high level grouping of pages, often alligned with top level navigation subCategory: 'string'; // sublevel grouping, optional type: 'quiz', // main purpose of the page, when in doubt ask question: 'How would a user describe this page?' id: 'my-quiz-id', // unique identifier for the page, for example the id of the article being viewed brand: { name: 'nectar' }, // the brand (method or series) that the page is associated with, optional pageName : 'my pagename' // a field used to identify and label individual pages on a website or application. (human readable) , optional }); </script>

To also include some information about how the user entered the page, it is possible to track the referrer event to identify the link that was used to start the navigation:

<script> mdat.referrer({ module: 'main-menu', // section of the page, e.g. main-menu, core, footer label: 'Do a quiz', // the label of the link, optional itemId: 'quiz', // a unique identifier for the functional navigation item elementId: 'quiz-icon', // a unique identifier for the html element that is the soure of the navigation }); </script>

All strings on both these events (except label) must be in kebab-case.

Identify event

If a user logs into your application, you can track the identify event:

<script> mdat.identify({ id: 'my-user-id', // the id of the user type: 'instructor', // optional, use one of 'instructor', 'learner' organisationId: 'my-guid', // optional the id of the organization classroomIds: ['group-one', 'group-two'], // optional the id of the group that the user is using cultureInfo: 'xx-YY', // optional the culture used by the user (language code-country/region code) isInternal: false, // optional if the user is internal }); </script>

Debugging

Debugging for the tracker can be enabled by opening the developer console and setting the mdatDebug variable to true.

mdatDebug = true;