How to pull data relative to the clicked element in Google Tag Manager

  Рет қаралды 31,935

MeasureSchool

MeasureSchool

Күн бұрын

Пікірлер: 68
@olgaannenko2296
@olgaannenko2296 3 жыл бұрын
I cannot thank you enough, Julian! I had this button inside a slider in the header part of the website that I couldn't get being tracked via GTM no matter what I tried: Click Class - "nope", Click Element - "not today", Click URL - "what's that?", nothing, NOTHING worked. I was about to throw my arms in the air and give up when I stumbled upon this video. And I did it!! I managed to get this button being tracked after all! So, thank you, thank you SO MUCH!!!
@romnaviche
@romnaviche Жыл бұрын
The button I wanted to track did not have anything unique to distinguish from similar buttons and I realized I couldn't use the click element variable to create the trigger I needed. This is exactly what I needed, thank you!
@eduardofernandes9881
@eduardofernandes9881 2 жыл бұрын
Hey Julian, I really appreciate you talking about more advanced techniques on how to use GTM. Thank you so much!
@richchoe5530
@richchoe5530 3 жыл бұрын
OMG! I really needed this! Now I can use this to pull in variables for labeling on Google Analytics. This will save me a ton of work since it will pull it in automatically AND it is a variable (so I don't have to make a new tag and trigger for every single button on every single page. You are the best!
@annaa7008
@annaa7008 5 жыл бұрын
I already used it with my element visibility triggers but in a different way (just with CSS Selector). This technique seems to be more effective! I'm gonna try it. Thanks for all your tips.
@julien5053
@julien5053 5 жыл бұрын
Thank you ! That's the first answer to an ecommerce project that I am working on : "How to set-up Audiences for Google Ads and Facebook Ads, with Google Tag Manager, for Dynamic Display Retargeting". (Google Merchant Center already set-up, and the same goes for Facebook Ads) The goal is to segment the audiences and target those who are more likely to buy the products, with Dynamic Display Retargeting. Especially, we have several audiences : those who have just seen the homepage, those who have been to a product page (without buying or adding to cart), those who clicked on Add to Cart (without buying).
@frankthedsigner558
@frankthedsigner558 4 жыл бұрын
This is AMAZING! Thank you so much. Had to watch it a couple of times to get into the swing of things but now I can link up all my elements using custom js. Thank you for the great videos, love this channel!
@MeasureSchool
@MeasureSchool 4 жыл бұрын
Nice one Frank!
@ZaraKayk
@ZaraKayk 4 жыл бұрын
These videos have been so helpful. I've only looked at GTM but I'll look up GA too. Thanks so much!
@maggieto
@maggieto 5 жыл бұрын
Thanks for the walk-through. This setup works as you're looking for a specific element like H1 which is usually used just once per page. If there are multiple elements of the same type, there will be an issue. I prefer .closest() or .parents() to avoid repeating parentElement multiple times.
@MeasureSchool
@MeasureSchool 5 жыл бұрын
but that's jQuery, not vanilla JavaScript. So you will need to have jQuery loaded, which is not applicable in every case
@MeasureSchool
@MeasureSchool 5 жыл бұрын
also: Even if there are multiple H1 on the page, this method should work. We are not searching for the H1 on the the whole page, but traversing upwards from the element that was clicked and looking for the next element that is H1. So it shouldn't matter how many H1 are on the page. And querySelector always returns the first element.
@stephanhokanson9682
@stephanhokanson9682 11 ай бұрын
I've been wanting to learn this for a while now. Thanks for sharing.
@brendanchase404
@brendanchase404 4 жыл бұрын
wow wish this video came out b4, thanks bro great work!!!!
@paulmurphy4821
@paulmurphy4821 Жыл бұрын
what an absolute hero. Great work Julian!
@AkankshaIngole
@AkankshaIngole Жыл бұрын
thanks julian very detail knowledge
@itsrodionraskolnikov
@itsrodionraskolnikov 4 жыл бұрын
This was incredibely useful. Thanks a lot!
@MeasureSchool
@MeasureSchool 4 жыл бұрын
That's good to hear Rodion!
@virginiakamala8921
@virginiakamala8921 2 жыл бұрын
This is truly amazing, Thank you soooo much!!
@beeroslava
@beeroslava 4 жыл бұрын
Woow, thank you for the great tutorial! I will check on the rest of your videos, this is so helpful! I was wondering how can you integrate this to Google Analytics in a way that tracks the number of t-shirts by name. I.e. Should I set up one goal using this click variable to be able to track how many of T-shirt 1 have been sold, and a different goal to track how many of T-shirt 2 have been sold? Or can I do this in one goal setup? Thanks!
@JoshuaDHarvey
@JoshuaDHarvey 4 жыл бұрын
This is a terrific video, thank you! If you ever get a chance to do a video that helps explain google ads cookies that would be great. Loving your channel though
@rushdihameed798
@rushdihameed798 4 жыл бұрын
I hav done the tags but how do u generate a report from google analytics?
@wellrafi3477
@wellrafi3477 3 жыл бұрын
thanks, it's work for me. very helpful
@GenePage
@GenePage 4 жыл бұрын
Great vid, but I wonder what happens next? You have the product title being loaded dynamically which is great, but I need to know how to get that to show up dynamically in Analytics so I can see how many clicks you got on Happy Ninja tag vs how many clicks you get on Woo Ninja? Goal Location won't narrow this down in my case because they're in a grid on the same page - url path. Please let me know if this is covered in another video.
@dariialeliukh6781
@dariialeliukh6781 3 жыл бұрын
Amazing! Thank you so much!
@reacher5394
@reacher5394 4 жыл бұрын
thx you Julian, and I have a little question, can I use this method to get the product value, so I can never need to use the data layer (which is writen before on the web page) !!! Is this correct ?????
@santiagocontreras7890
@santiagocontreras7890 5 жыл бұрын
Thanks for this tutorial Julian! I was wondering if this technique can be used to track info in forms fields also, or if it´s only for text content in a page/article. Cheers!
@MeasureSchool
@MeasureSchool 5 жыл бұрын
yes, could be
@NicolayBell
@NicolayBell 3 жыл бұрын
well that’s concerning… doesn’t that mean it could be used to track passwords as well?
@AnsweringATPL
@AnsweringATPL 3 жыл бұрын
Thank you for this video. I have a question though. How to pull data within the span tag .
@MeasureSchool
@MeasureSchool 3 жыл бұрын
what do you want to pull? can you be more specific?
@AnsweringATPL
@AnsweringATPL 3 жыл бұрын
@@MeasureSchool Thank you for your response, sir. In this video, you teach how to pull data between tag DATA. my question is how to pull data inside tag i.e. . I am using GTM4WP and try to do add to wishlist tag for Facebook. Once again thank you sir
@ankitgarg3518
@ankitgarg3518 3 жыл бұрын
HI Julian, what if we need to set the custom java script code on Just Link? Because your video shows the parent element is fetching on "click" trigger. should we use the same code for "link click" or we need to change the code. Example: google_tag_manager["GTM-5GSLPT7"].dataLayer.get('gtm.linkelement').parentElement.parentElement.parentElement.parentElement.parentElement.querySelectorAll(".title-accordion").innerText
@Hammadhussain47
@Hammadhussain47 5 жыл бұрын
Can you please refer to the video where you explain how to track amazon affiliate link tracking through GTM thanks.
@MeasureSchool
@MeasureSchool 5 жыл бұрын
oh... yes, of course. One method is kzbin.info/www/bejne/homyf4ucj7aZfNE and another kzbin.info/www/bejne/fYbRaYuNarKXaKs
@Hammadhussain47
@Hammadhussain47 5 жыл бұрын
@@MeasureSchool Great thanks man for the videos
@alexandrakeogh
@alexandrakeogh 2 жыл бұрын
I'm trying to pull out the aria-valuenow element nested deep in something like this:
@akashmv6553
@akashmv6553 4 жыл бұрын
Hi MeasureShool, I have a Pincode Field and a Check button, I want to capture the Pincode entered in that field. can you please help me with any tips on this. Thank you for your video's it helped me a lot.
@AltGilani
@AltGilani Жыл бұрын
Will this still work in Google Analytics 4 setup?
@ottz73
@ottz73 4 жыл бұрын
I have a span tag wrapped in the button so when you click the span my information is in the button element but can't get back
@WeightLossThatSticks
@WeightLossThatSticks 4 жыл бұрын
Aren't a lot of these things already supplied to the analytics tags with the underlying software (e.g. WooCommerce). It seems that using tag manager is in a way complicating this whole process.
@quality-analyticsd6-innova162
@quality-analyticsd6-innova162 4 жыл бұрын
This is very helpful, but seems to not be working for my specific use case. Same idea, when a user clicks on a cell, I want to return the title of the cell. I am able to get to the correct level, but still cannot pull the specific text. I have the element " and I am trying to output SweetSkate, but cannot grab that portion of the element. Any thoughts?
@quality-analyticsd6-innova162
@quality-analyticsd6-innova162 4 жыл бұрын
I was able to grab the aria-label, but the actual issue is that there are multiple elements wrapped into "one" button. Some of the elements' parents reaches one level above the current click, while some are levels below. How do you account for that?
@ilyasemenkov5492
@ilyasemenkov5492 5 жыл бұрын
Thanks, Julian! I wonder if there's a reference on the query options list that we might also play with.
@MeasureSchool
@MeasureSchool 5 жыл бұрын
not sure what you mean by query options list?
@sarahcondon2621
@sarahcondon2621 5 жыл бұрын
@@MeasureSchool I think I have a similar question. This tutorial makes sense for this specific need, but I don't know JS and am trying to reference something else in the parent/parents for different scenarios - like the class above click class e.g. section class, li class, etc.
@MeasureSchool
@MeasureSchool 5 жыл бұрын
ah ok... you can google for "traversing the dom with javascript" and kind find a reference to the JS commands available. Also flukeout.github.com is a good little game to learn about css selectors.
@beingrajbir
@beingrajbir 5 жыл бұрын
I have some problem. I do in my Affiliate Website-there are many products in one-page. I put all the process and its only fetch the data of first product rest of the product will not display the title it will show the first product title only. Can You Help me on it
@leonardobigardi7926
@leonardobigardi7926 3 жыл бұрын
Thanks, Julian! I tried this technique and it worked well for me but I noticed that I just can pull data when I click on a specific part of the button and not the entire button. I'm not working with "parentElement" function. Instead of that I'm using "children" function to get the data I want. After ("gtm.element") my CJS looks like that: children[0].children[0].children[0].innerText How can I adjust that to pull data from clicks on any part of the button?
@MeasureSchool
@MeasureSchool 3 жыл бұрын
have a look into the closest function in JS
@waqaswakeel
@waqaswakeel 5 жыл бұрын
Hy Julian! I'm Interested in your Paid Course but I see you are Charging Monthly Payment is There any One Time Fee Process. It is much better for me. And I also want to know you are also providing training related to Google ADS & Facebook ADs as well in same course. Ecommerce Selling training as well Thanks Regards Aryan khan
@jayjayf9699
@jayjayf9699 5 жыл бұрын
With this technique I no longer have to use the Wordpress gtm plug-in by Thomas gieger ? I can use this method to get dynamic conversion values for my Facebook tag ?
@MeasureSchool
@MeasureSchool 5 жыл бұрын
no, this is not a replacement for a proper dataLayer implementation
@agarwalsunny4067
@agarwalsunny4067 4 жыл бұрын
There trick is more helpful on category pages where you have so many add to cart buttons and you want to pull specific clicked product id
@MeasureSchool
@MeasureSchool 4 жыл бұрын
true that
@GlennDaytonIV
@GlennDaytonIV 4 жыл бұрын
Perfecto!
@richchoe5530
@richchoe5530 3 жыл бұрын
What if there is more than one text within the "innerText"? how do you isolate the different text?
@richchoe5530
@richchoe5530 3 жыл бұрын
Never mind. I realized that I was using the wrong CSS selector!
@ramcharankette4782
@ramcharankette4782 4 жыл бұрын
can we have a video of adding to cart with enhanced ecommerce (like adding an ecommerce object to the datalayer by the site and getting that pushed to the analytics)
@MeasureSchool
@MeasureSchool 4 жыл бұрын
thanks for the suggestion
@Harris-baz
@Harris-baz 2 жыл бұрын
I try to solve the problem in two ways, (of course the 2 ways can be wrong i dont now) so my problem is this: I want to make a click element 1. google_tag_manager["GTM-N3NC622"].dataLayer.get("gtm.element").parentElement.parentElement.querySelector("div.vrc-save-order-block").innerText but the show this "" and if i put it in Variables its dont work 2. google_tag_manager["GTM-N3NC622"].dataLayer.get("gtm.element").parentElement.parentElement.querySelector("div.vrc-save-order-block").innerHTML the show its correctly but also dont work at Variables Thank you very much, waiting for some help, greetings from Greece
@sahilsunesara
@sahilsunesara 4 жыл бұрын
Hi I wanted to add content_ids in facebook pixel but i am unable to find variable or data layer in magento 2... so could you please tell me how will i get that details? Thanks in advance
@MeasureSchool
@MeasureSchool 4 жыл бұрын
either you program in a dataLayer or you get a plugin that provides the info
@sahilsunesara
@sahilsunesara 4 жыл бұрын
@@MeasureSchool sorry? I didn't get you? program in a dataLayer?
@ChrisGriffinP
@ChrisGriffinP 5 жыл бұрын
Another great tutorial, Julian! This looks like a technique similar to one you explained in your DOM Element Scraping video (kzbin.info/www/bejne/pKmoio2qncetppY). Which technique do you prefer when trying to pull page information into the dataLayer? Thanks!
@MeasureSchool
@MeasureSchool 5 жыл бұрын
no, they are similar, but not the same. With this method you can pull data RELATIVE to your click. With the other method you go from top (the document node) to the target, regardless where a user clicks
New GTM Custom Templates explained (feat. Kevin from Bounteous)
9:01
Top 10 Variables for Google Tag Manager
19:11
MeasureSchool
Рет қаралды 31 М.
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 493 М.
I Took a LUNCHBAR OFF A Poster 🤯 #shorts
00:17
Wian
Рет қаралды 16 МЛН
Data Layer in Google Tag Manager || GTM Data Layer Tutorial with examples
22:33
Analytics Mania - Google Analytics & Tag Manager
Рет қаралды 154 М.
How to Use CSS Selectors in Google Tag Manager
34:41
MeasurementMarketing,io
Рет қаралды 7 М.
3 ways to use the google_tag_manager JavaScript object
15:19
MeasureSchool
Рет қаралды 8 М.
Google Tag Manager Simplified - A Straightforward Guide
1:08:03
Loves Data
Рет қаралды 89 М.
Click Element Variable in Google Tag Manager (how to use it correctly)
16:12
Analytics Mania - Google Analytics & Tag Manager
Рет қаралды 44 М.
Google Analytics 4 Tutorial for Beginners (2024) || 1-hour GA4 course
59:21
Analytics Mania - Google Analytics & Tag Manager
Рет қаралды 106 М.
How to access parent element's ID with .closest() in Google Tag Manager
11:09
Analytics Mania - Google Analytics & Tag Manager
Рет қаралды 3,6 М.
Send Customer Information To Facebook (w/Data Layer)
18:10
Vertex Marketing Agency
Рет қаралды 10 М.
Data Layer Explained With Practical Examples in Google Tag Manager
13:53
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 493 М.