"

Google Tag Manager DOM Element Variable (Scraping) explained

The DOM Element Variable is a powerful variable in Google Tag Manager to scrape Content directly from the Document Object Model. With its help, you can transfer any Text on your website into a Variable and pass it on to your Marketing tools, as long as it is selectable in the DOM.
In this video, I’ll show you how you can use the DOM Element Variable with the CSS Selector and how it works.

btw… the method I’m using to check the selector is document.querySelectorAll(“p.price ins span.amount”)

helpful Links:

http://www.w3schools.com/cssref/css_selectors.asp
http://www.simoahava.com/analytics/matches-css-selector-operator-in-gtm-triggers/
https://tagmanger.google.com

Course: https://measureschool.com/youtube

RECOMMENDED MEASURE BOOKS: https://kit.com/Measureschool/recommended-measure-books

GEAR WE USED TO PRODUCE THIS VIDEO: https://kit.com/Measureschool/measureschool-youtube-gear

SHOW MORE...

15
Leave a Comment

avatar
 
smilegrinwinkmrgreenneutraltwistedarrowshockunamusedcooleviloopsrazzrollcryeeklolmadsadexclamationquestionideahmmbegwhewchucklesillyenvyshutmouth
6 Comment threads
9 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
7 Comment authors
Oguzhan SoyerStuart ClarkFrankJulianJulian Recent comment authors
newest oldest most voted
Oguzhan Soyer
Guest
Oguzhan Soyer

hey, you misspelled the tagmanager smile

Julian
Guest

where?

Oguzhan Soyer
Guest
Oguzhan Soyer

at the bottom, where you set the links.

Stuart Clark
Guest

Think this is it – “https://tagmanger.google.com”

Oguzhan Soyer
Guest
Oguzhan Soyer

hey, you misspelled the tagmanager smile

Frank
Guest
Frank

Hey Julian,

Thanks for illustrating how to use the css selector but would it be possible for you to also demonstrate the element id that you skipped? I understand that in that example it wasn’t unique. I just can’t find any resource to help with element id.

Julian
Guest

it might be because you didn’t tick the Google Tag Manager option inside of VWO in your test settings

Shannon
Guest
Shannon

Hi Julian,

I have it clicked for all campaigns. When following the directions on VWO’s site I get the data in UA no problem. But that is for one campaign and I really like the idea of your custom javascript so it can stay dynamic. I just can’t see the VWO under summary in preview mode though.

Julian
Guest

odd. if you have the GTM option the VWO code should push the events into the dataLayer automatically, unless your website prevents it somehow

Julian
Guest

it might be because you didn’t tick the Google Tag Manager option inside of VWO in your test settings

Shannon
Guest
Shannon

Hi Julian,

I have it clicked for all campaigns. When following the directions on VWO’s site I get the data in UA no problem. But that is for one campaign and I really like the idea of your custom javascript so it can stay dynamic. I just can’t see the VWO under summary in preview mode though.

Julian
Guest

odd. if you have the GTM option the VWO code should push the events into the dataLayer automatically, unless your website prevents it somehow

Julian
Guest

if you want to select an element that has an Id you can use # sign to select it. https://www.w3schools.com/cssref/css_selectors.asp

Frank
Guest
Frank

Hey Julian,

Thanks for illustrating how to use the css selector but would it be possible for you to also demonstrate the element id that you skipped? I understand that in that example it wasn’t unique. I just can’t find any resource to help with element id.

Julian
Guest

if you want to select an element that has an Id you can use # sign to select it. https://www.w3schools.com/cssref/css_selectors.asp

Frank
Guest
Frank

Hey Julian thanks. https://www.w3schools.com/cssref/trysel.asp this was also very helpful in my understanding

Julian
Guest

great resource, thanks

ice9web
Guest

Thank you so much for all these tutorials… I really learned a lot… even though I myself is a Google Analytics Certified also a GTM certified … still I learned so much in your tutorials (^_^) thank you.

Julian
Guest

thanks for the kind words

Julian
Guest

great resource, thanks