TiQ Switch: A minimal Profile and Environment switcher bookmarklet

Tealium Expert
Tealium Expert

Hi all,


For those of you who might be interested, I have created a very minimal Profile and Environment switcher bookmarklet.


I wanted to have an environment switcher that just did the job, while being browser-agnostic and easy to use.

That led me to create this bookmarklet "TiQ Switch", including the use of JavaScript alerts and prompts, which I normally don't use anymore ;-).


The account used it "hard set" in the script code, but all you have to do to change to another profile and/or environment to enter a valid [profile]/[Environment] value in the input field and click the button below that field.

Then the page reloads using the new profile/enviroment.


If you enter value in the correct format, but for a non-existing profile and/or environment, you will "remove" Tealium iQ from your currently debugged pages.

Remove Tealium iQ cookies from you domain to fix that, preferably only the enviroment switcher cookie, being named in a profile/environment name format.


If you have any problems using either below bookmarklet code or non-bookmarklet code, then please refer to the mentioned GitHub repository.




TiQ Switch screenshots

TiQ Switch - Popup prompt

TiQ Switch - Input error

TiQ Switch - Tealium iQ not found

Sorry about the Danish word "Siger" in the above screenshots ;-)
It actually just means the same as "says" in English.
My browser just felt that it needed to write it in Danish.


The bookmarket

I can't seem to add the bookmarklet as a link in this message.

But you can grab the link code here, or look at the GitHub repository, which also includes the "non-garbled" non-bookmarlet version.



Add a bookmark to your browser and put the above code in there, to be able to use the bookmarklet yourself.


A "non-garbled" non-bookmarlet version 

// Check for utag object
if (typeof utag === 'object') {
    var newEnviroment = prompt('New Tealium iQ environment?', utag.data['ut.profile'] + '/dev');
    if (/^(\w|[-_])*\/(\w||[-_])*$/.test(newEnviroment)) {
        // Get an array of all cookie names (the regex matches what we don't want)
        var cookieNames = document.cookie.split(/=[^;]*(?:;\s*|$)/);

        // Remove any that match the pattern
        for (var i = 0; i < cookieNames.length; i++) {
            if (/^utag_env_/.test(cookieNames[i])) {
                document.cookie = cookieNames[i] + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/';

        // Set new environment cookie, and reload page
        document.cookie = 'utag_env_' + utag.data['ut.account'] + '_' + utag.data['ut.profile'] + '=//tags.tiqcdn.com/utag/' + utag.data['ut.account'] + '/' + newEnviroment + '/utag.js';
    else {
        alert('Input not entered correctly!\r\r' +
            'Please enter in the following format:\r' +
            'PROFILE/ENVIRONMENT\r\r' +
            'Example:\r' +
else {
    alert('Telium iQ not found on page!');


Check it out at GitHub



Feel free to use, comment and modify.

But please let me know if you find it useful, or chose to upgrade or modify it.

Let's share and make each other smarter :-)


Please also share knowledge about other helper tools for implementing or debugging Tealium iQ implementations.


Best regards,

Peter Meyer


Best Regards

TiQ Switch: A minimal Profile and Environment switcher bookmarklet

Employee Emeritus

GREAT stuff @pmeyerdk! I love it!


There is a complete list of Tealium Tools! And that's all I've got. Anybody else want to share?

Remember to give me a kudo if you like my post! Accepting my post as a solution is even better! Also remember that search is your friend.