Thought I could use the Content Modification extension to add a simple <meta ...> tag to the list of other such tags in <head..>. Realised that there is no id= I can use to hook it on to. I don't do xPath, could that be used here and what should I then enter as Identifier??
Solved! Go to Solution.
Hi @per_lundqvist - I took a look, and the Content Modification extension will always insert a <div> (with your 'content' inside), so you won't be able to use it to insert a <meta> tag directly into the head as you're hoping.
I know it's not what you were asking for (and I'm sure you know how to do this), but it's pretty easy to insert a <meta> tag with JS:
var n = document.createElement('meta');
n.name = "test-meta-insertion";
var d = document.head;
Hi @ErikDekker, if you put the snippet above into a JS extension with Pre Loader scope, a meta tag should be added the head, and that meta tag should also be picked up and added to the utag.data object on the page (works in my tests).
What are you seeing instead?
I looked in the sourcecode and didn't see the meta tag. When I look in the Tealium Tools I didn't see the extension loaded, but when I looked in the data > HTML metadata in the tealium Tools I saw the meta property. So it wasn't that obvious but I think it works now...
thnx for helping out,
Hi @ErikDekker, excellent - glad it's working!
In case it's interesting for you: It makes sense that it wouldn't show in the source code, since we're injecting it via JS after the source has loaded. But you should be able to see it in the 'Elements' tab of Developer Tools, since that view contains the info from the source as well as any dynamic changes that happen after page load. Any DOM changes in TiQ can be checked like that.