Setting TrackingServer to Data Element

johncfl

27-09-2018

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!

Accepted Solutions (1)

Accepted Solutions (1)

ursboller

MVP

27-09-2018

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;

Answers (2)

Answers (2)

johncfl

27-09-2018

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.