4

I would like to try to track the user with the collect via the web and analytics tool.

I inserted the collect shown in the documentation

Basic web observation code

<script type = "text / javascript" src = "http://MID.collect.igodigital.com/collect.js"> </script>
<script type = "text / javascript">
_etmc.push (["setOrgId", "MID"]);
_etmc.push ([ '_trackPageview']);
</ Script>

copy this code and insert above "trackPageView"

_etmc.push (["setUserInfo", {"email": "INSERT_EMAIL_OR_UNIQUE_ID"}]);

Replace "INSERT_EMAIL_OR_UNIQUE_ID" with the dynamic code to get the customer ID. A customer ID is typically an email address or custom number unique to that customer.

I tried with the mail, subscriber key and subscriber id.

But I think I'm wrong something because they are always anonymous to me.

is there any setting to do first?

thank you

3
  • Are you sending both trackPageView and setUserInfo in same payload? Sending setUserInfo alone will not register the identifier with the cookie uuid. – Lukas Lunow Feb 2 '20 at 13:11
  • If you are using above code then replace the MID with your MID and Insert Unique ID with the emailaddress or the variable you have declared to capture the Unique Identifier for a prospect. – pragyanshu kukreti Feb 3 '20 at 9:19
  • Please share the actual code you have inserted on the website – Lukas Lunow Feb 3 '20 at 9:33
0

First you have some errors in your code:

  • trackpageView with etmc.push is written completly wrong
  • you have many whitespaces that are bad, especially </ Script> and text / javascript

This is the basic code you want to add, when you want to track any site on your website.

<script type="text/javascript" src="http://MID.collect.igodigital.com/collect.js"> </script>

<script>
  _etmc.push(["setOrgId", "MID"]);
  _etmc.push(["trackPageView"]);
</script>

When you know the subscriber / customer you will add the following:

_etmc.push(["setUserInfo", {"email": "INSERT_EMAIL_OR_UNIQUE_ID"}]);

When you know which kind of item the subscriber is viewing at the moment (on that particular site) the trackpageview has to get more details:

_etmc.push(["trackPageView", { "item" : "INSERT_PRODUCT_CODE" }]);

When you would know that this particular product is from a specific category or you are on a category page of "SalesforceStackExchange" you would even define trackpageview further:

_etmc.push(["trackPageView", {"item":"XXXX", "category":"SalesforceStackExchange"}]);

And even further when you know a search team like "Lukas Lunow":

_etmc.push(["trackPageView", {"item":"XXXX", "search": "Lukas Lunow", "category":"SalesforceStackExchange"}]);

Final result on an item page of item XXX on category SalesforceStackExchange where you searched for the "Lukas Lunow" COULD BE:

<script>
  _etmc.push(["setOrgId", "MID"]);
  _etmc.push(["setUserInfo", {"email": "123456"}]);
  _etmc.push(["trackPageView", {"item":"XXXX", "search": "Lukas Lunow", "category":"SalesforceStackExchange"}]);
</script>

Does that answer your Question?

2
  • we have found that the setUserInfo only works properly when you use an email address. If you use anything else, it pushes into Marketing Cloud, but vital information about the subscriber is missing in Contact Builder. How did you solve this? – garek007 Jul 23 '20 at 21:54
  • This is just wrong. It depends on the subscriberkey. If you set the subscriberkey as email you have to use email, if you use a unique identifier as subscriberkey you need to use the unique identifier. The only thing that does not work out of the box when using unique IDs is the recommendation email block (you need to recode it with ampscript). Please eloborate what you mean by "vital information". Maybe create an own topic for it and share the link in a comment to this post. – Johannes Schapdick Jul 24 '20 at 8:45

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.