1

We're trying to implement collect code for our organization to track identified visitors clicking through to our website from SFMC emails. We've implemented the collect code with the unique ID considering we utilize MC Connect to establish Sales Cloud Contact ID as subscriber key.

<script type="text/javascript">       
   _etmc.push(["setOrgId", "XXXXX"]);     
   _etmc.push(["setUserInfo", {"email": "Contact ID"}]);     
   _etmc.push(["trackPageView"]);    
</script>

My question is what customizations need to be made to the URLs in the emails we want to track from. I understand we'll need to enter %%Contact ID%% somewhere to dynamically populate the URL. But what should we add additionally on the URL to inform the website what to pull?

2 Answers 2

2

You'll need to set up the Web Analytics Connector (WAC) to pass the unique identifier (Contact ID). If you look at the Collect.js file, you'll see the query parameters that are needed from WAC to be able to identify the subscriber:

setConversionTrackingInfoFromUrl: function() {
this.email_job_id = this.getURLParameter("sfmc_j") || this.getURLParameter("j");
this.email = this.getURLParameter("sfmc_e") || this.getURLParameter("e");
if (this.email != null) {
  if (this.user_info) {
    this.user_info.email = this.email;
  } else {
    this.user_info = { "email" : this.email };
  }
}
this.email_list_id = this.getURLParameter("sfmc_l") || this.getURLParameter("l");
this.email_landing_url_id = this.getURLParameter("sfmc_u") || this.getURLParameter("u");
this.email_job_batch_id = this.getURLParameter("sfmc_jb") || this.getURLParameter("jb");
this.email_subscriber_id = this.getURLParameter("sfmc_s") || this.getURLParameter("s");
this.mid = this.getURLParameter("sfmc_mid") || this.getURLParameter("mid");

 },

Those parameters (l,u,jb,s) would get automatically added to all your URLs using the Web Analytics Connector.

2
  • Great minds think alike :) Apr 12, 2019 at 20:01
  • @LukasLunow Lol. I think you beat me by 15 seconds. Apr 12, 2019 at 20:02
0

I will recommend you to reach out to Marketing Cloud support in order for them to enable Web Analytics Connector - this will allow you to append the Contact ID to all your email links automatically. You can of course also still append it manually - e.g. subid=0033000000GvHjL

You will also need to use e.g. jqurery to fetch it from the url, unless you use Google Tag Manager, where it can be done more automatically.

let searchParams = new URLSearchParams(window.location.search)
if searchParams.has('subid') {
let contactID = searchParams.get('subid')
_etmc.push(["setOrgId", "XXXXX"]);     
_etmc.push(["setUserInfo", {"email": contactID}]);     
_etmc.push(["trackPageView"]);    
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .