I've setup our SFMC collect code to track visits to our website and so far it is working, but we're only getting anonymous visits. I would like to track when a subscriber visits our website after clicking a link in an email and any subsequent pages they visit and bring that data back into SFMC (and SFDC) so that I can use it in a Journey and possibly in dynamic content (show them more of what they were looking at on the website). I found this page in the SFMC documentation: https://help.marketingcloud.com/en/documentation/collect_code/install_collect_code/set_user_info/

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

I'm not using email as a unique Id for my subscribers, so I'm wondering if I need to:

1.) Change "email" to something else like "SubscriberID"

2.) How I can grab a fulfill the SubscriberID in the second portion of the pairing and can this be done if or only if a subscriber navigates to a page from an email link where I can pass through the subscriberId


Strictly speaking, you do not need to use the email address as the Unique Identifier in PI, but if you do choose to use some other identifier, you'll be fighting an uphill battle. The Product guys who do PI don't talk to the Product guys that do the other parts of the Marketing Cloud, so the Contact Builder and Audience Builder integrations both make the assumption that email address is the key being used in PI.

If you take a look at the Collect.js file that's served, it details what query string paramters you can pass to set the cookie and track directly from the email click through. There's a function called "setConversionTrackingInfoFromUrl" that's of interest that's called first when you call '_etmc.push(["trackPageView"]);'.

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");

You'll see in the above all the query string parameters the Collect code's expecting in order to automatically set the user info based on a click through from an email. Weirdly, these are not the parameters added to link where you select "Is Conversion Tracking Link" in the UI, so I guess you're supposed to add these your self to your URL or raise a case with Support to add these params to your Web Analytics Connector ("WAC") configuration. From memory, there's a Brand Tag specific to conversion tracking link parameters. Maybe someone should walk down the corridor in Indy, grab some people from the PI team and introduce them to the Email team.

Also what's strange is how nobody documents this. "Knowledge is power", I guess.

  • Thanks Andrew, this is very helpful. I looked at the Collect.JS file briefly and was mostly tracking down the "setUserInfo" function, thank you for pointing out this conversion tracking function, I'll definitely investigate down this path. Fingers crossed I'll be able to piece something together. Totally agree on the product alignment and documentation issues with SFMC, their formal documentation has been very unhelpful, incomplete and sometimes just completely out-of-date. It seems like to do anything not strictly on the happy path you have to figure something out yourself. Thanks again! – ZackB Jul 23 '17 at 14:54
  • You WILL get there down this path. Frustrating how you need to know the questions to ask, for sure. – Macca Jul 23 '17 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.