- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
Hi, assuming I would like to get the following script in the HEAD tag of the site by publishing with Tealium:
<script type="text/javascript" data-set="1234" src="//mysystem.com/my_js_file.js"></script>
I read this article https://community.tealiumiq.com/t5/Developers/Tealium-Custom-Container/m-p/1182 but unsure on how to add the script, as it mentions to not use script tag in the custom container section.
Could you point me how to I add the above script in the Tealium Custom Container JS section? Thanks
There are a couple of points you should think about.
1) Why does this need to be in the head tag?
2) Does the code need to load synchronous or is asynchronous sufficient?
3) By default, Tealium's utag.js will be at the top of the body tag, then usually script tags are added to the last script tag found (which is often in the head tag)
4) The Tealium Custom Container requires a user of TiQ to write JavaScript, however often times the Tealium Generic Tag will work and does not require writing JavaScript which can keep down on bugs and typos.
Check out these two articles and let us know if they help you out.
https://community.tealiumiq.com/t5/Developers/Tealium-s-Generic-Tag/m-p/760/highlight/true#M3750
https://community.tealiumiq.com/t5/Developers/Installing-Recipe-Tracking-Pixels/m-p/9888#M4003
The only part that seems different is the data-set="1234" within the script tag. If this is a requirement, let me know I can look to see if how we can support this attribute.
Brian
Hi,
I have a similar question, I need to use Tealium for apply a hotfix in the website. I was reading the documentation, and if I undestand good, I need to modify the template of the Custom Tag Container, Is there any other way to apply a hotfix without modifying Custom Tag template?
Thank you,
12-03-2015 02:54 AM - last edited on 12-03-2015 09:39 AM by kathleen_jo
Hi @miguel_molina,
So if you really need to add a hotfix for your site in Tealium, you can use a JavaScript Extension scoped to either Pre-Loader or Dom-Ready.
Adrian
Thanks Brian:
1) It needs to be in the HEAD tag because of performance. Scripts in HEAD tags will load / start before the BODY, so I would like to keep in that.
2)The code load synchronously on the page and it executes asynchronously
3)Ok
4)Ideally I 'd like to keep the script tag somehow and avoinding to write the script in the HEAD dynamically with an immediate JS function.
The data-set attribute is a requirement, as without it the script would not work.
Would you still reccomend to use a Generic Tag rather than a Customer Container?
It is not possilbe in JavaScript to load an additional JavaScript library synchronously when the parent library was loaded asynchronously. Since utag.js is loaded asynchronously, we cannot load your library synchronously. Tealium does have an additional file utag.sync.js which can be setup in the head tag by your web developer. Then you can load your library via this utag.sync.js file. The benefit here of putting Tealium's additional file in the head is that if you have additional files you need to load synchronously in the future, you will be able to add them via Tealium. You also will be able to remove these files in the future as you see fit without the need to involve your web developer.
Here are a few articles that talk about utag.sync.js
Copyright All Rights Reserved © 2008-2023