Expand my Community achievements bar.

Help shape the future of AI assistance by participating in this quick card sorting activity. Your input will help create a more effective system that better serves your needs and those of your colleagues.
SOLVED

Setting TrackingServer to Data Element

Avatar

Level 2

Hello,

In Adobe DTM, we are trying to create a data element that returns a first party trackingserver based on the site domain. Ultimately, we want to set this data element in the trackingserver field of the Experience Cloud ID service tool in DTM. We need to do this as we host multiple domains in one DTM profile.

Can anyone give me some tips on how I would go about doing this? For example, we want trackingserver to be set to smetrics.domain1.com for domain1.com and smetrics.domain2.com for domain2.com.


Right now, I have a data element set up with the following custom script:

if(window.location.href.indexOf(".domain1.com") != -1)

{s.trackingServerSecure="smetrics.domain1.com"}

if(window.location.href.indexOf("domain2.com") != -1)

{s.trackingServerSecure="smetrics.domain2.com"}

Pretty sure this is wrong because I shouldn't be setting the s.trackignServer in the custom script. Would appreciate any help!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

jexnerW4D​ wrote an article how to do it about a year ago: https://webanalyticsfordevelopers.com/2017/01/17/blog-battle-customize-analytics-in-dtm/

how it works:

1) use a data element to return the name of the desired "rsid" (reportsuiteID)

2) change custom code of anayltics in DTM to use the desired rsid (based on the data element).

for 1) you can follow the article mentioned above (see screenshot there). for 2) here is an example of a custom code used in the "analytics configuration. Please test it before using it in production!

s.usePlugins = true;

function s_doPlugins(s) {

  // determining which report suite to use

  var newrsid = _satellite.getVar("Report Suite ID");

  _satellite.notify("Setting rsid to " + newrsid, 2);

  // setting report suite for this tracking call

  s.sa(newrsid);

}

s.doPlugins=s_doPlugins;

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

jexnerW4D​ wrote an article how to do it about a year ago: https://webanalyticsfordevelopers.com/2017/01/17/blog-battle-customize-analytics-in-dtm/

how it works:

1) use a data element to return the name of the desired "rsid" (reportsuiteID)

2) change custom code of anayltics in DTM to use the desired rsid (based on the data element).

for 1) you can follow the article mentioned above (see screenshot there). for 2) here is an example of a custom code used in the "analytics configuration. Please test it before using it in production!

s.usePlugins = true;

function s_doPlugins(s) {

  // determining which report suite to use

  var newrsid = _satellite.getVar("Report Suite ID");

  _satellite.notify("Setting rsid to " + newrsid, 2);

  // setting report suite for this tracking call

  s.sa(newrsid);

}

s.doPlugins=s_doPlugins;

Avatar

Level 2

Thanks. That was a good read but it hasn't helped the current issue I'm having because I'm trying to dynamically change the trackingserver, not the RSID.

Avatar

Community Advisor

can't you do it the same way? instead of changig the rsid, use this:

s.trackingServer = s.trackingServerSecure = "xxx.xxx.xxx";