Setting TrackingServer to Data Element | Community
Skip to main content
johncfl
Level 2
Sep 27, 2018 6:49 PM UTC
Solved

Setting TrackingServer to Data Element

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Urs_Boller
Urs_BollerAccepted solution
New Participant
Sep 27, 2018 7:45 PM UTC

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;

3 replies

Urs_Boller
New Participant
Sep 27, 2018 8:43 PM UTC

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

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

Translate
johncfl
johncflAuthor
Level 2
Sep 27, 2018 7:56 PM UTC

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.

Translate
Urs_Boller
Urs_BollerAccepted solution
New Participant
Sep 27, 2018 7:45 PM UTC

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;

Translate