Introduction:

UTM parameters are a powerful way to track the performance of your marketing campaigns, as they provide insights into how users arrive at your website. By capturing UTM parameters, you can understand the sources, mediums, and specific campaigns that drive traffic to your website, allowing you to optimize your marketing strategies. In this blog post, we will discuss how to capture UTM parameters using Marketing Cloud Personalization (formerly Interaction Studio), use them in triggered campaigns, and feed them into Journey Builder using SQL for a UTM log using the Primary Key and Created Date. We will also cover the addition of new profile attributes in Interaction Studio.

Adding New Profile Attributes:

To fully utilise the captured UTM parameters in Marketing Cloud Personalization, you need to add new profile attributes to store the data. You should add the following attributes:

| Name | Label | Type | Classification Override | Identity Type |
| utm_source | UTM Source | String | Non-Sensitive | N/a |
| utm_medium | UTM Medium | String | Non-Sensitive | N/a |
| utm_campaign | UTM Campaign | String | Non-Sensitive | N/a |
| utm_term | UTM Term | String | Non-Sensitive | N/a |
| utm_content | UTM Content | String | Non-Sensitive | N/a |

By adding these attributes, you can store and analyse the UTM data in Marketing Cloud Personalization, allowing you to create personalised and targeted marketing campaigns based on user behavior and campaign performance.

Capturing UTM Parameters with Marketing Cloud Personalization:

To capture UTM parameters with Marketing Cloud Personalization, you can use the following code snippet using the Evergage syntax:

Evergage.init({
cookieDomain: "example.com"
}).then(() => {

const utmParameters = getUTMParameters();

// Sitemap configuration object
const sitemapConfig = {
global: {
    onActionEvent: (actionEvent) => {
        actionEvent.user = actionEvent.user || {};
        actionEvent.user.attributes = Object.assign({},actionEvent.user.attributes,Object.fromEntries(Object.entries(utmParameters).filter(([key, value]) => value !== null))
);
return actionEvent;
},
},

    pageTypeDefault: {
        name: "default"
    },

    pageTypes: [
        {
            name: "home",
            action: "Homepage",
            isMatch: () => /^\/$/.test(window.location.pathname),
            contentZones: [
            ],
            listeners: [
            ]
        },
        {
            name: "view_page",
            action: "Viewed - " + window.location.pathname,
            isMatch: () => { return true; }
        },
    ]
};

function getUTMParameters() {
    const parsedUrl = new URL(window.location.href);
    const queryParams = new URLSearchParams(parsedUrl.search);

    const utmParameters = {
        utm_source: queryParams.get('utm_source') || 'direct',
        utm_medium: queryParams.get('utm_medium') || 'direct',
        utm_campaign: queryParams.get('utm_campaign') || 'direct',
        utm_term: queryParams.get('utm_term') || 'direct',
        utm_content: queryParams.get('utm_content') || 'direct'
    };

    return utmParameters;
}

Evergage.initSitemap(sitemapConfig);   
});

In this code, we first initialise Marketing Cloud Personalisation with the appropriate cookie domain. Then, we define a sitemap configuration object that includes the global onActionEvent function. This function captures UTM parameters for each action event by checking the URL parameters, and if they are not present, it defaults to 'direct'. This is important because it allows us to track users who visit the website directly, without coming from a specific marketing campaign or source.

Using Triggered Campaigns to Send UTM Parameters to Journey Builder:

With the captured UTM parameters, you can create triggered campaigns in Marketing Cloud Personalization that send the data back into Journey Builder. By using SQL queries, you can feed the UTM parameters into a UTM log, allowing you to analyse and segment your audience based on their UTM data.

Create a data extension in Marketing Cloud to store the UTM parameters. This data extension should have the ContactKey field and any additional fields you want to send from Personalization to Marketing Cloud;

| Field Name | Data Type | Value |
| ContactKey | String | PK |
| utm_source | String | Nullable |
| utm_medium | String | Nullable |
| utm_campaign | String | Nullable |
| utm_term | String | Nullable |
| utm_content | String | Nullable |
| triggered_date | Date | Current Date |

Make sure to include the fields used in the triggered template for each campaign experience in Personalisation.

In Journey Builder, create an API event as the journey's entry source using the data extension you created in Marketing Cloud. This will allow you to use the UTM parameters captured by Marketing Cloud Personalization in your journeys. For more information, see API Event Entry Source Use Case.

Build and launch the journey you want to use with the campaign. As part of the journey, you can add decision splits based on the UTM parameters to create different paths for users coming from various sources, mediums, or campaigns.

To feed the UTM parameters into a UTM log, use SQL queries in Automation Studio to extract the data from the data extension and insert it into another data extension specifically created for the UTM log. This allows you to analyze and segment your audience based on the captured UTM data.

Conclusion:

Capturing UTM parameters with Marketing Cloud Personalization (formerly Interaction Studio) is an effective way to understand your marketing campaigns' performance and user behavior. By using the provided code snippet and adjusting it to match either the SalesforceInteractions or Evergage syntax, you can implement a solution that captures and stores UTM parameters for later analysis and personalization. By adding new profile attributes and incorporating the captured data into triggered campaigns and Journey Builder, you can create more targeted and personalised marketing campaigns that resonate with your audience and ultimately drive better results.

Tags:

Interaction Studio, Marketing Cloud Personalization, Marketing Cloud, Personalisation