Menu
Activation Studio
  • Home
  • Solutions
    • ---
      • Segment Designer
      • Score Designer
      • Interaction Designer
    • ---
      • Marketing Cloud Segmentation
      • Lead management
      • Journey tracking
  • Pricing
    • Get quote
    • FAQ
  • Contact
Activation Studio Activation Studio
  • Home
  • Solutions
    • ---
      • Segment Designer
      • Score Designer
      • Interaction Designer
    • ---
      • Marketing Cloud Segmentation
      • Lead management
      • Journey tracking
  • Pricing
    • Get quote
    • FAQ
  • Contact
Demo
Popular Search stitch sfmc subssalesforceparameter managementrfm modelabandoned cart

Getting started

  • Using Data Designer in Contact Builder
  • Setup subscriber filter business unit
  • Adding Score and Interaction Designer to Data Designer
  • Setting up roles & rights

Segment Designer

  • Creating your first segment Marketing Cloud

Score Designer

  • Calculating Total Score by Opportunity with Salesforce Marketing Cloud SQL

Interaction Designer

  • How to setup interaction tracking SFMC?
  • How to stitch visitors and SFMC subscribers?
  • Using parameter management Marketing Cloud
  • Using Postman to test interactions in Interaction Designer

Use cases

  • Setting up abandoned cart in Salesforce Marketing Cloud
  • Understanding RFM Analysis and Building an RFM Model in Marketing Cloud
  • Calculating Total Score by Opportunity with Salesforce Marketing Cloud SQL

FAQ

  • How does lead conversion to a Contact work in Marketing Cloud?
  • How often are scores per subscriber refreshed?
  • Marketing Cloud Automation Studio and Activation Studio?
  • Home
  • Docs
  • Interaction Designer
  • How to stitch visitors and SFMC subscribers?

How to stitch visitors and SFMC subscribers?

Did you have setup the Parameter Management in Marketing Cloud? If yes, the Marketing Cloud subscriberKey is added to the click out URL’s. Next step is to catch the parameter when a SFMC subscriber clicks on a link in an email and navigates to your website.

In our example we will be using:

 mcparam=%%subscriberkey%%

Example Google Tag Manager setup

Creating custom variable for query parameter

To store the parameter as a variable take the following steps:

  1. Navigate to your GTM container
  2. Navigate to ‘Variables’
  3. Add a new ‘User defined variable’
  4. Configure the variable type as a ‘URL’
  5. Choose component type ‘Query’
  6. In the ‘Query Key’ field enter the parameter you used in the Parameter Management
  7. Save the variable
Catch the Salesforce Marketing Cloud subscriberKey query parameter Google Tag Manager

Configure trigger subscriberKey Marketing Cloud

To listen for the parameter we need to setup a trigger. This trigger will fire when the parameter is found.

  1. Go to ‘Triggers’
  2. Add new trigger
  3. Choose Trigger Type ‘Page View’
  4. Fire trigger on ‘Some Page Views’
  5. Include the newly created variable ‘SubscriberParameter’
  6. Choose dos not match Regex ‘^(undefined|null|0|false|NaN|)$’
  7. Save trigger
{{Variable}} does not match RegEx (ignore case) ^(undefined|null|0|false|NaN|)$
Configure new trigger Google Tag Manager subscriberKey Salesforce Marketing Cloud

Store subscriberKey in cookie via new tag

To be able to also use the subscriberKey after the first pageview, you can store the subscriberKey in a cookie. To do so follow these steps.

  1. Navigate to ‘Tags’
  2. Create new tag
  3. Choose ‘Custom HTML’
  4. Use your own script or use our example cookie script below
  5. Use the trigger we created above ‘mcparam query’
Store the Salesforce Marketing Cloud subscriberKey in a cookie in Google Tag Manager

Example cookie javaScript

<script>
 
var cookieName  = "mcparam"; 
var cookieValue = {{subscriberParameter}};
var cookiePath  = "/";
var domain  = ".youdomain.com";
var expirationTime = 31536000;                           //For example one month in seconds (2628000)
expirationTime = expirationTime * 1000;                 //Convert expirationtime to milliseconds
 
var date = new Date();                                  //Create javascript date object
var dateTimeNow = date.getTime();                       //Get current time in milliseconds since 1 january 1970 (Unix time)
date.setTime(dateTimeNow + expirationTime);             //Set expiration time (Time now + one month)
var expirationTime = date.toUTCString();                //Convert milliseconds to UTC time string
document.cookie = cookieName+"="+cookieValue+"; expires="+expirationTime+"; domain="+domain+"; path="+cookiePath;  //Set cookie
</script>

Add custom variable to capture cookie value

Last step is to store the cookie value in a custom variable for future use. Follow the steps below to do so.

  • Navigate to ‘Variables’
  • Add a new ‘User defined variable’
  • Configure the variable type as a ‘1st Party Cookie’
  • Enter ‘mcparam’ as the Cookie Name
  • Save the variable
Store the cookie value in a custom variable Google Tag Manager for Salesforce Marketing Cloud

Next step using the variable in Google Tag Manager tags

After creating an interaction in Activation Studio and exporting the TPL file. You can configure the tag to include the subscriberKey. This is mandatory to link interactions in Marketing Cloud with subscribers.

  1. Setup new Tag
  2. Configure the variable fields
  3. Link SubscriberKey with the custom variable ‘mcparam’ created above
  4. Choose a trigger; for example all pageviews
  5. Use an exception for when the variable ‘mcparam’ is null
Use the Salesforce Marketing Cloud subscriberKey as a variable in Interaction Designer tags

Creating an exception trigger

To make sure we won’t trigger when the variable is empty, you can setup an exception trigger.

{{Variable}} matches RegEx (ignore case) ^(undefined|null|0|false|NaN|)$
Setting up exception trigger Google Tag Manager cookie subscriberKey Salesforce Marketing Cloud
What are your Feelings
Still stuck? How can we help?

How can we help?

How to setup interaction tracking SFMC?Using parameter management Marketing Cloud

Harvest Tech Labs

© All rights reserved.
Powered by Harvest Tech Labs.

Salesforce Marketing Cloud

Available on AppExchange Salesforce

Info

  • Contact us

  • Book a demo

  • Interactive Product Demo

  • Get a quote

  • Pricing

  • Privacy policy

  • 30 day free trial

Discover

  • Development roadmap

  • News

  • Releases

Learn

  • What is Salesforce Marketing Cloud?

  • Knowledge base

More

  • Harvest Digital

  • Direct Messenger

Activation Studio
Leonard Springerlaan 29
9727KB, Groningen
the Netherlands

+31850049792