Is there any way to write a dataLayer check (using Google Tag Manager) without using numbers?
Currently, I am using:gtm.element.51.value
Here is a screenshot of the dataLayer structure. Condensed for viewing.
https://imgur.com/a/9O01R
I have checkboxes that dynamically appear on this page, thus making the "51" number change depending on the number of checkboxes they select.
Thanks,Brian
Related
I have a banner with 3 images on my homepage. I want to track how many people are clicking on one of the image (The specific one) as a conversion on Google analytics. I am planning to use Tag manager trigger to capture this action.
I have added a specific ID called "ciaBannerHome"
On the Tag Manager triggered, I have the setting below,
However, it is not capturing when people is clicking on the banner.
Below is what is showing on output variables on Google Tag Manager:
An Element is not a string, it's an object. Therefore, an Element doesn't typically 'contain'. Elements usually match CSS-selectors. So change the contain condition to the match CSS-selector one.
In the value of the Click Element the debugger shows you a very precise CSS selector for it rather than the value of the element. An Element object is usually quite large to show here. Also, the preview usually doesn't stringify objects to show the values. And not every object can be stringified anyway.
In your case, a CSS selector to match would be #ciaBannerHome where # indicates that "ciaBannerHome" is the id of the to-be-clicked element.
Was wondering if someone could help me out or provide some guidance with some things I'm looking to do with Google Tag Manager.
I'm fairly new to GTM but I've already got two basic tags set up:
Track All Page Views
Track all Link Clicks
I've got the above two working and sending data to my Google Analytics account.
What I'm having trouble with is the following:
My website has a bunch of single pages that each have an audio player on them. I would like to track when a user does the following:
Clicks the Play Button
Clicks the Download Button
On top of that, I would like to:
Track the timestamp of the song when a user clicks the Pause Button or exits the page.
Here's an example of one of the pages I would like to implement these tags on: https://www.jimmypressplay.com/mashup-last-friday-night-i-wanna
For #1 and #2, I've tried a bunch of things with no success. I've messed around with the "Click - All Elements" and "Custom Event" Trigger Types and I've set the trigger to fire when the click element matches the div/button class of the play button. I've also messed around with setting up a custom variable (by using either the "Auto-Event Variable" or "DOM element" options). But none of that seems to work (but obviously I am probably doing something wrong).
For #3, I haven't tried tackling that yet, but I've noticed in the code in the "slider slider_is-active" div class it has an element ("aria-valuenow") that keeps track of the current timestamp, so I'm guessing there should be some way to return that timestamp if I am able to set it up as a custom variable somehow.
If anyone has some free time and could take a look and point me in the right direction, that would be great! Or if I need to provide more info, let me know.
Thanks!
I have a Wordpress one-pager (salient theme using visual composer) with four buttons.
Every one is linked to the same contact form, which is correct.
Now I want to add a specific ID to each button in order to track which one is most effective in Google Analytics.
I track my other events using Google Tag Manager.
1) You need to create a trigger in GTM:
This trigger will capture clicks on all buttons which is opening contact modal popup
2) You need to create a custom variable, which will take a heading of the section, where this button is located.
Code is: function() {
return jQuery({{Click Element}}).closest('.wpb_wrapper').find('.vc_custom_heading').text();
}
3) Create a tag which will send data to GTM
4) Check your events in GA.
Keep in mind that it might take a couple of hours to appear in Behaviour-> Events tab. Or you can check it immediately in Real Time -> Events tab
I have a gallery of products that each belong to a specific brand. In order to track down how many impressions/reach the brands generate I was thinking about using GTM, having a trigger on DOM load or pageview, and have it read a specific class "brandlink" for the text inside this element. This way if the page loads products from Amazon, eBay and Walmart, each pageview would trigger multiple events, one for each brand, with the label = their_brand_name.
In a very similar fashion as to how ads are tracking the number of impressions they generate.
I can clearly see the "Click classes" variable, but not something that reads the text inside a class, without a click being necessary.
Pointers? Different approach? Thank you!
One method would be to create a trigger that uses the DOM Element variable type.
You can see how the Variable configuration uses the element ID (alternatively, you could use CSS selector method). And then in the Trigger configuration, you can it to fire on DOM ready if that particular DOM element exists and has a certain value (if you have more than one value, you could use a regex matching pattern).
It's nice to use DOM variable if you want to select click element by special css-selector, just write {{variable}} instead this selector in css-match input field
Is it possible to automatically # a field on a Google Form? I would need the numbering to appear on the actual form and not just on the spreadsheet it ties to. The idea is so that someone could place an order, fill out the form, and give the automatically generated # to the vendor.
Please point me in the right direction if this is possible.
Thanks!
Have an item for this number and define it as required and select-from-a-list. Generate the number (somehow?) in the OnLoad trigger and populate this item. The number being the only one to select user has to select and send with the form. Bit crude solution, but workable I think.
Better option would be to make that item a section header and populate in onload trigger as above.
Available types of triggers indicates that there is no onLoad trigger within Google Forms API. However, I believe it is possible to use jQuery to search for '#' within the form and increment the value.