Want to change SiteCatalyst Report Suite ID or Google Analytics Account ID based on the Tealium environment you're using? Read this article!

 

Scenario

You want to change the value of a data source you are mapping to a tag based on the environment it is in. For example, you want to change the Account ID sent to Google Analytics based on the environment the tag is pushed to.

Solution #1: For utag versions 4.35 and below

Step 1 : Add a 'tealium_environment' and 'ga_account_id_standard' as Data Sources

(how to add a data source?)

add env data source.png

 

ga id data source.png

Step 2 : Set value for 'tealium_environment' data source

Create a 'Set Data Values' extension and set 'tealium_environment' to equal the following JS Code:

utag.cfg.path.split('/')[6];

set tealium env.png

This extension will pull in the environment that Tealium is running in from the page in lower case:

e.g. if you are in the 'prod' environment then 'tealium_environment' will be set to 'prod'

Step 3 : Create a lookup table Extension to set the different values of the Data Source you want to change

In this example, you are setting different Google Analytics Account IDs based on the environment:

lookup ga id.png

Note : Ensure this runs AFTER the extension setting 'tealium_environment'. Otherwise, it won't have a value to look up against!

Step 4 : Map your Data Source to the tag you want

For this example, map the "ga_account_id_standard" Data Source to the "Account" destination in Google Analytics.

map to ga account.png

 

after mapping.png

 

Step 5 : Save and publish your Tealium iQ profile. 

You're done! Everything should be working for you now!

Solution #2: For utag versions 4.36 and above

This method eliminates the need to create and set the value of “tealium_environment” data source. Instead, you will make use of “ut.env”, which is the built-in variable for publish environment and only available to utag v4.36 and above. Here's how to go about it:

Step 1: Add a ‘ ut.env’ data source

ut env data source.png

Step 2: Create the lookup table like you did earlier, only now you will set the Lookup Value In to “ut.env”.

lookup with ut env .png

Step 3: Map the “ga_account_id_standard” data source to the ‘Account’ destination, just like you did earlier.

Step 4: Save/Publish your profile.