Back

This guide shows the configuration and workflow for self-hosting the utag.js files.

Before you begin, contact your Account Manager to verify the contracted terms for this feature on your account to ensure availability and appropriate licencing is maintained. 

The article contains the following sections:

Table of Contents Placeholder

Overview

Tealium iQ publishes your utag.js files to our highly-scaled Multi-CDN Infrastructure. When utag.js is implemented on your website, the file is sourced from tags.tiqcdn.com. If you have requirements that prevent you from loading external JavaScript files (or have other restrictions) we offer the ability to self-host these files on your own server. The generated utag files are still published to our CDN, but they are also made available in a zip archive which can be easily transferred to your system.

The main difference in self-hosting is in the code snippet used to load utag.js on your website. The domain and path to that file must be updated to reflect your server location that hosts the files. In the following example you can see the URL change from Tealium's standard location to a self-hosted location.

Original Tealium snippet:

<!-- Tealium Universal Tag -->
<script type="text/javascript">
(function(a,b,c,d){
a='//tags.tiqcdn.com/utag/[ACCOUNT]/[PROFILE]/[ENV]/utag.js';
b=document;c='script';d=b.createElement(c);d.src=a;
d.type='text/java'+c;d.async=true;
a=b.getElementsByTagName(c)[0];a.parentNode.insertBefore(d,a)
})();
</script>

Self-Host snippet:

<!-- Tealium Universal Tag -->
<script type="text/javascript">
(function(a,b,c,d){
a='//YOURDOMAIN.com/CUSTOM/PATH/[ENV]/utag.js';
b=document;c='script';d=b.createElement(c);d.src=a;
d.type='text/java'+c;d.async=true;
a=b.getElementsByTagName(c)[0];a.parentNode.insertBefore(d,a)
})();
</script>

Enabling the Zip Archive 

The first step is to enable the zip archive so that you can retrieve the necessary files from iQ. The zip archive is a file named distro.zip that is created every time a publish occurs. It contains all the necessary files to run your instance of utag.js. This file is not generated by default, so it must be enabled.

To enable the distro file: 

  1. Click Save/Publish
  2. Click Configure Publish Settings...
  3. On the General Publishing tab, under the Implementation section, find the Generate distro.zip file setting and toggle it to On.
  4. Click Save

iq-self-hosting-generate-distro-zip.jpg

Setting Published File Location

The published file location is a setting that tells the utag.js code where to load subsequent utag files (eg. utag.4.js). Remember, the code snippet to load utag.js will be adjusted to use your custom self-hosted location, but the loading of the other utag files occurs dynamically based on the logic within utag.js and the default location is Tealium's Multi-CDN domain.

To change the published file location:

  1. Click Save/Publish
  2. Click Configure Publish Settings...
  3. On the General Publishing tab, under the Publishing URLs section, enter the domain and full path to your self-hosted files, one for each environment (omit the actual file name) eg. //example.com/custom/path/prod/
  4. Click Save

Include the environment in your path to support the built-in dev, qa, and prod targets.

Publish All Environments

You have now enabled the downloadable distro.zip file. You will notice that the code snippet in the Code Center now displays the custom location of your hosted utag.js instead of Tealium's default Multi-CDN location.

iq-self-hosting-code-center.jpg

The final step is to publish the profile to all environment targets (dev, qa, prod). This will ensure you have a distro.zip file generated for each environment.

Publish Work Flow

iq-self-hosting-version-download.jpgYou will continue to manage your tags within iQ, but each time you save and publish you will need to download the new distro.zip file and unzip the files to your own server.

To download and verify the distro.zip file:

  1. From the Versions tab, find the last published version, expand the Publish Details for each environment and click Download Distro Zip File.
  2. Unzip the distro.zip file on your server in the location specified in the custom Publishing URLs setting.
  3. Using the code from Code Center, add the utag.js code snippet to your website.
  4. Using the browser console, verify that your webpage is loading utag.js from your self-hosted location and not from Tealium's Multi-CDN domain tags.tiqcdn.com.

 

Using Version Labels

Lastly, after you make the utag files available on your live site we recommend taking one last step to label the released version in iQ using Version Labels.  This will indicate to users of your account which versions have completed your internal software release cycle.

self-hosted-version-label.jpg

SHA256 Digest Signatures

For extra security concerns, you can verify the contents of the files by clicking the Distro Verification link from the publish details area where you downloaded distro.zip. This will show the SHA-256 checksums for each file in the archive.

self-hosted-sha256-digest.jpg

 Then you can use your favorite checksum utility to verify the digest signatures of the files on your hosted location. Here is the SHA-256 checksum for utag.js, which matches the value seen in iQ.

self-hosted-shasum.jpg