- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
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??
Thanks!
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";
n.content="success";
var d = document.head;
d.appendChild(n);
05-25-2018 05:42 AM - last edited on 05-25-2018 05:51 AM by kathleen_jo
Hello @calebjaquith,
I am not quite experienced with this but can you tell me how to add the code to get the meta description in the head. I tried the javascript extension with pre loader and with dom ready, but both don't add the meta tag to the head of the page.
Kind regards,
Erik
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?
Hello @calebjaquith,
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,
Kind regards,
Erik
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.
Best
Caleb
Copyright All Rights Reserved © 2008-2023