Understand information in your reports and troubleshoot reporting issues such as self-referrals, (not set) data, and inaccurate information
 
Guide Me
star_border
Reply

Event Label

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello.  I work for a library, and we are trying to track in our new catalog a button to reserve items.  The reserve button is built differently depending on the way it is access; either from a standard search or a direct record search.

Here is the code for the standard search reserve button:

<div class="reserve_button">

      <div class="reserveItem">

            <a onclick="Search.Results.reserve('1.447168');return false;" href="#"><span>Reserve</span></a>

      </div>

</div>

 

 Here is the code for the direct record reserve button:

<div class="recordOptions">
      <div class="option optReserve">
            <a onclick="Search.Record.reserve('dojoUnique1');return false;" href="#"><span>reserve</span></a>
      </div>

</div>

 

I have Google Tag Manager catching the Click on the Reserve button.  I can see the trigger fire, but the issue is with the tag.  If i set up the tag label to be {{Click Element}}, then in analytics I can see the event label as [objectHTMLSpanElement].  I am glad that I can see something, but what I would really like to see is the two different texts: Search.Results.reserve and Search.Record.reserve.

Any help is greatly appreciated.  I've been racking my brain for a few weeks with this.

1 Expert replyverified_user

Re: Event Label

[ Edited ]
Rising Star
# 2
Rising Star

Hi EBRPL R,

The best thing to do would be to add a html id to each with the text you want. The id will let you control your triggers more easily and is best practice.

You're lucky you are picking up anything as the return false can be problematic for click listeners. A good plugin for Chrome is dataSlayer. It lets you easily see what's available to the listener and the information is available even after navigation page to page - unlike preview mode.

https://chrome.google.com/webstore/detail/dataslayer/ikbablmmjldhamhcldjjigniffkkjgpo?hl=en-US

Hope that helps!

Best,

Theo Bennett

,

Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Event Label

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Theo,
Thank you for responding. I should have clarified in my original post that we purchase our catalog interface from a vendor. I can change some basic things and some css, but I don't actually have access to the html code or that contains the reserve buttons or any of their javascript.
I've only been using Tag Manager for about 6 months, so I am still at a pretty basic level. I was wondering though if creating a Data Layer Variable would get the information I want. Any thoughts?
Thanks again!

Re: Event Label

Rising Star
# 4
Rising Star
Hi EBRPL R,

A dataLayer variable would only help if the value you were looking for was constructed and available in the dataLayer so that's not going to work.

You can try a CSS selector (instead of ID) from the DOM element variable and see if that works for you.

That or you could specify the trigger using a CSS Selector differently in two tags or a lookup table variable for the label. Simo Ahava is the man and he has a very useful post on GTM CSS Selectors for triggers here:

http://www.simoahava.com/analytics/matches-css-selector-operator-in-gtm-triggers/

Best,

Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Event Label

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭


Theo,
Actually the first trigger configuration I tried was the Click Classes & CSS selectors, and I really thought that would work since I could see they had different CSS classes. That didn't work, and I have tried about 8 different trigger/tag variations ( I am keeping a list Smiley Happy because this is driving me crazy to not have it solved yet ). I checked out the dataslayer plugin.

I have been trying to attach screenshot, but I keep getting an error message that there is invalid html with a pic inserted in here.

So the dataslayer plugin is showing me information that looks like this:

gtm.element                  element

Click Text                         RESERVE

gtm.elementClasses    

gtm.elementId

gtm.elementTarget

event                                gtm.click

gtm.elementURL

event                                gtm.load

event                                gtm.dom

gtm.start                         string of numbers

event                                gtm.js

This makes sense to me because I've only been able to see the events in GA when the trigger is set up to fire on the Text equals Reserve. I am not sure why the gtm.elementClasses does not have any information.

 

Simo's blog is great; I always tend to find myself there. Thanks again for your help!

Re: Event Label

Rising Star
# 6
Rising Star
I know the image problem is a MAJOR pain. The JavaScript action (onclick) of the buttons may be hindering you (I'm not a developer).

It's possible to create code to change that but I would not recommend it as it's not stable.

Can you use your click text as the label? It looks like one begins as a capital and the other does not. That could be your flag as to which was clicked...

Best,

Theo
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Event Label

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
We had some custom css that was transforming the reserve text in both buttons to uppercase. I removed that css, and went ahead & set up a unique tag & trigger for both the lower case and upper case reserve buttons. I am seeing the 2 different events in my GA now, so that is exciting. I will just need to check with the bosses about the style changes I made.
Thanks for your help!

Re: Event Label

Rising Star
# 8
Rising Star
Awesome! Glad I could help and happy analyzing. [😊]


Best,


Theo
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn