Highlighted

Using a proxy in-between to map to the dev and qa folder for testing

Bronze Contributor
Bronze Contributor

If I use Charles Proxy or another Proxy inbetween like Fiddler to map the url to the dev items, will this allow me to test without having to use the Tealium Web Companion? The reason being on page transitions there are tags that only fire once, but I have to load the companion to have it change the new page to DEV then refresh the page, but the events won't fire again.

I've done some testing and it seems to work, has anyone found any problems with doing this?

 

 

 

4 REPLIES 4
Highlighted

Using a proxy in-between to map to the dev and qa folder for testing

Bronze Contributor
Bronze Contributor
 
Highlighted

Using a proxy in-between to map to the dev and qa folder for testing

Tealium Employee

No problems with doing this @BradHenderson. We do this internally quite commonly, as it's the most accurate way to ensure that the environment switching does not cause any timing issues. It's also very useful for testing mobile apps where there is no web companion option.

 

We also have a plugin that works with our Chrome extension, Tealium Tools, which you can find here:

 

https://chrome.google.com/webstore/detail/tealium-tools/gidnphnamcemailggkemcgclnjeeokaa

 

Once installed, you can add a custom tool by URL:

 

https://solutions.tealium.net/hosted/tealiumTools/env_switcher/env_switcher.json

 

This method gives the same convenience of the web companion, but uses Chrome's internal proxy service to redirect the file permanently, so essentially achieves the same end goal as using Charles.

 

 

Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.
Highlighted

Using a proxy in-between to map to the dev and qa folder for testing

Tealium Employee

And if worse comes to worse, you can always just manually set the cookie. Web Companion is simply doing this:

 

document.cookie="utag_env_account_profile=\/\/tags.tiqcdn.com\/utag\/account\/profile\/environment\/utag.js;path=/";

 

For example, for tealium/main:

 

document.cookie="utag_env_tealium_main=\/\/tags.tiqcdn.com\/utag\/tealium\/main\/qa\/utag.js;path=/";

 

Note the "env" value near the start does not change. The environment is set in the path.

Highlighted

Using a proxy in-between to map to the dev and qa folder for testing

Tealium Expert
Tealium Expert

Hi @BradHenderson,

 

If you want to use Fiddler for this purpose, you can use the FiddlerScript I am including here.

The point of this particular script, is to make it a bit easier for non-coders, to paste the script and modify as little as possible to make it work.
You will therefore see, that the Tealium iQ account is supposed be "hardcoded", since it would wouldn't need to be changed often, compared to what you really need to change, e.g. hostname, existing - and changed profile and environment.


Using a proxy tool like Fiddler, will also activate the prod -> dev environment change for all browsers and programs on your computer, not just one single browser.

I generally like to use tools like Fiddler or Charles because of this, compared to the use of different extensions in different browsers.

 

Insert, and modify, the following FiddlerScript in the "OnBeforeResponse" section of the menu item "Rules / Customize Rules ...".

 

//---------------------------------------------------------------
// START - Tealium iQ - Change Environment for specific site
//---------------------------------------------------------------
var tiqChange_Hostname = "www.mydomain.com";
var tiqChange_EnvironmentExisting = "default/prod";
var tiqChange_EnvironmentNew = "sandbox/dev";
 
if (oSession.HostnameIs(tiqChange_Hostname) && oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")){
    oSession["ui-backcolor"] = "orange";
    oSession["ui-color"] = "black";
    oSession["ui-bold"] = "true";
 
    oSession.utilDecodeResponse();
          oSession.utilReplaceInResponse("//tags.tiqcdn.com/utag/MYACCOUNT/" + tiqChange_EnvironmentExisting + "/utag.js",
                                    "//tags.tiqcdn.com/utag/MYACCOUNT/" + tiqChange_EnvironmentNew + "/utag.js");
}
//---------------------------------------------------------------
// END - Tealium iQ - Change Environment for specific site
//---------------------------------------------------------------


In the code, change the two words "MYACCOUNT" to the name of your own the Tealium iQ account, and save the code snippet for later use.

 

 

After that, your only supposed to change the three top-most variables to their relevant values.

 

tiqChange_Hostname = The entire hostname you want to change Tealium iQ environment for

tiqChange_EnvironmentExisting = The Tealium iQ profile and environment you want to change from
tiqChange_EnvironmentNew = The Tealium iQ profile and environment you want to change to

The two later variables are to be defined in the format: [PROFILE]/[ENVIRONMENT].

This allows you to also change to another profile, for instance a "sandbox" profile created for test purposes only.

 

Best regards,
Peter

 

Best Regards
Peter