- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog Blog
- Support Desk Support Desk
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:
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>
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:
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:
//example.com/custom/path/prod/
Include the environment in your path to support the built-in dev, qa, and prod targets.
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.
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.
You 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:
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.
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.
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.
Copyright All Rights Reserved © 2008-2022