Send tracking data to Sitecore CDP

Abstract

Describes how to capture and send UTM parameters to Sitecore CDP (Data model 2.0).

Sitecore CDP enables you to capture tracking data when you send a VIEW event. The VIEW event is the only event type you can use to capture tracking data.

The following is an example of how to send an HTTP GET request to a website containing Urchin Tracking Module (UTM) parameters:

HTTP GET https://www.yoursite.com/search?utm_source=google&utm_medium=cpc&utm_campaign=sprint_sale

The following JavaScript example demonstrates how to capture UTM parameters on a VIEW event:

// Place an anonymous function in the Boxever queue 
_boxeverq.push(function() { 
    var viewEvent = {
        "browser_id": Boxever.getID(),
        "channel": "WEB",
        "type": "VIEW",
        "language": "EN",
        "currency": "EUR",
        "page": "/home",
        "pos": "spinair.com"
    };
    //Add UTM params
    viewEvent = Boxever.addUTMParams(viewEvent);
    // Invoke event create 
    // (<event msg>, <callback function>, <format>)
    Boxever.eventCreate(viewEvent, function(data){}, 'json');
});

The following is a JSON example of sending a VIEW event that captures UTM parameters:

{
    "channel": "WEB",
    "type": "VIEW",
    "language": "EN",
    "currency": "EUR",
    "page": "home",
    "pos": "spinair.com",
    "browser_id": "f76cb8e2-9ca9-4c15-8836-85e497904c5c",
    "utm_source": "google",
    "utm_medium": "cpc",
    "utm_campaign": "spring_sale"
}