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


1 Answer 1


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, 2017 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, 2017 at 16:16
  • @Macca what happens if you try to use Salesforce ID instead of email? We are seeing that in Contact Builder attributes, we don't see page views and other attributes unless we use email. You said it would be an uphill battle.... We figure we can run a query to update the data, but curious how you solved this. Jul 23, 2020 at 21:24
  • @garek007 In their wisdom, the team that devised the Contact Builder design for replicating Collect data hard-coded the relationships between the IGO tables and the Contact model to be based on the email address of the contact and this can't be changed. If you use something other than the email address in All Subs as your "email" in Collect, the relationship between the IGO tables and the contact model won't work, which is what you're seeing - the email address of your contacts is not their CRM ContactID. You'll also see that Einstein Engagement Scoring for conversions is also broken.
    – Macca
    Jul 24, 2020 at 1:24
  • You'll find that most SFMC users do not use the email address as their "email". It's pretty bad practice from a privacy perspective. Mostly, they'll opt for another value to use, like a hash of the email or the SubscriberKey (CRM Contact/Lead ID) and just choose to put up with the limitations of the Contact Model and Engagement Scoring. You could potentially script creating shadow profiles in Collect that use your Contact/Lead ID with Automation Studio, fork collect to make two calls for each event or update your tags to make two calls., so that Contact Builder/Engagement Scoring work, again.
    – Macca
    Jul 24, 2020 at 1:31

You must log in to answer this question.

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