Track Kantar Focal Meter events on web
This plugin provides integration with Focal Meter by Kantar. Focal Meter is a box that connects directly to the broadband router and collects viewing information for the devices on your network.
This integration enables measuring the audience of content through the Focal Meter router meter. The plugin has the ability to send the domain user ID to a Kantar Focal Meter endpoint. A request is made when the first event with a new user ID is tracked.
The plugin inspects the domain user ID property in tracked events.
Whenever it changes from the previously recorded value, it makes an HTTP GET request to the kantarEndpoint URL with the ID as a query parameter.
Optionally, the tracker may store the last published domain user ID value in local storage in order to prevent it from making the same request on the next page load. If local storage is not used, the request is made on each page load.
The plugin is available since version 3.16 of the tracker.
The Focal Meter integration is automatic once configured.
Install plugin
- JavaScript (tag)
- Browser (npm)
| Tracker Distribution | Included |
|---|---|
sp.js | ❌ |
sp.lite.js | ❌ |
Download:
| Download from GitHub Releases (Recommended) | Github Releases (plugins.umd.zip) |
| Available on jsDelivr | jsDelivr (latest) |
| Available on unpkg | unpkg (latest) |
npm install @snowplow/browser-plugin-focalmeteryarn add @snowplow/browser-plugin-focalmeterpnpm add @snowplow/browser-plugin-focalmeter
Enable integration
- JavaScript (tag)
- Browser (npm)
To integrate with the Kantar FocalMeter, use the snippet below after setting up your tracker:
window.snowplow(
'addPlugin',
'https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-focalmeter@latest/dist/index.umd.min.js',
['snowplowFocalMeter', 'FocalMeterPlugin']
);
window.snowplow('enableFocalMeterIntegration', {
kantarEndpoint: '{{kantar_url}}',
useLocalStorage: false // optional, defaults to false
});
import { newTracker } from '@snowplow/browser-tracker';
import { FocalMeterPlugin, enableFocalMeterIntegration } from '@snowplow/browser-plugin-focalmeter';
newTracker('sp1', '{{collector_url}}', {
appId: 'my-app-id',
plugins: [ FocalMeterPlugin() ],
});
enableFocalMeterIntegration({
kantarEndpoint: '{{kantar_url}}',
useLocalStorage: false // optional, defaults to false
});
The enableFocalMeterIntegration function has the following arguments:
| Parameter | Type | Default | Description | Required |
|---|---|---|---|---|
kantarEndpoint | string | - | URL of the Kantar endpoint to send the requests to (including protocol) | Yes |
processUserId | (userId: string) => string | - | Callback to process user ID before sending it in a request. This may be used to apply hashing to the value. | No |
useLocalStorage | boolean | false | Whether to store information about the last submitted user ID in local storage to prevent sending it again on next load (defaults not to use local storage) | No |
If you choose to storage the last submitted user ID in local storage, the plugin will use the key sp-fclmtr-{trackerId}. The trackerId is your tracker namespace.
Processing the user ID
By default, the plugin sends the domain user ID as a GET parameter in requests to Kantar without modifying it.
In case you want to apply some transformation on the value, such as hashing, you can provide the processUserId callback in the enableFocalMeterIntegration call:
- JavaScript (tag)
- Browser (npm)
window.snowplow('enableFocalMeterIntegration', {
kantarEndpoint: "https://kantar.example.com",
processUserId: (userId) => md5(userId).toString(), // apply the custom hashing here
});
import md5 from 'crypto-js/md5';
enableFocalMeterIntegration({
kantarEndpoint: "https://kantar.example.com",
processUserId: (userId) => md5(userId).toString(), // apply the custom hashing here
});
Configure multiple trackers
If you have multiple trackers loaded on the same page, you can enable the Focal Meter integration for each of them by specifying the tracker namespace as the third parameter to the enableFocalMeterIntegration function:
- JavaScript (tag)
- Browser (npm)
window.snowplow(
'enableFocalMeterIntegration',
{ kantarEndpoint: 'https://kantar.example.com' },
['sp1', 'sp2'] // Only these tracker namespaces will send to Kantar
);
enableFocalMeterIntegration(
{ kantarEndpoint: 'https://kantar.example.com' },
['sp1', 'sp2'] // Only these tracker namespaces will send to Kantar
);
Request format
The tracker will send requests with this format:
GET https://your-kantar-endpoint.com?vendor=snowplow&cs_fpid=d5c4f9a2-3b7e-4d1f-8c6a-9e2b5f0a3c8d&c12=not_set
Where:
vendoris alwayssnowplowcs_fpidis the domain user ID, or the processed version if aprocessUserIdcallback is providedc12is alwaysnot_set