Using the tracker on 3rd party websites

This manual is meant for 3rd party marketing websites and explains the basic usage of the Infinitas Learning data analytics tracker as an embedded script.

Usage

Getting started

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

Alternatively, you can use the script from our Content Delivery Network (CDN).

Example:

<script src="https://yw5hbhl0awnz.noordhoff.nl/tracker/mdat.js"></script>

OpCo-specific CDN URLs:

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 Infinitas Learning operating company the site is for (noordhoff, liber or plantyn) }); </script>

You can place the script in either the <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 aligned with top-level navigation subCategory: 'sub-section', // Sub-level grouping, optional type: 'quiz', // Main purpose of the page. When in doubt ask: '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-page-name', // 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 source 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 IDs of the groups that the user is in cultureInfo: 'xx-YY', // Optional, the culture used by the user (language code-country/region code) isInternal: false, // Optional, if the user is an internal user }); </script>

Debugging

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

mdatDebug = true;