IMG elements wrapped in A elements don’t register click events
-
**Summary**
We’re having an issue with click events not registering in Google Analytics. Specifically, any time we have an IMG element wrapped in an A element that has data- attributes, the click event appears in the realtime bar chart but does not show up in the list of events. Links with no HTML inside them do appear in the list of events.
**Preconditions**
– This plugin installed and a GTM account configured
– We assume we are using the default GTM configuration (we inherited the site)
– You have a site with the following HTML<a href="https://mysite.com" data-category="Link Tracking" data-label="External Link" data-action="Clicked an external link"> See my other page </a> <a href="https://mysite.com" data-category="Link Tracking" data-label="External Link" data-action="Clicked an external link image"> <img src="images/see-my-other-page.jpg" /> </a>
**Steps to Reproduce**
1. Open page in a browser
2. Click the first link (no image)
3. Click event appears in realtime activity and in the list of events
4. Click the second link (with an image)**Expected Result**
– Click event appears in realtime activity
– Click event is added to the list of events below the realtime activity**Actual Result**
– Click event appears in realtime activity
– Click event is NOT added to the list of events below the realtime activity**Workaround**
– None known but I’ve considered adding the click event via JavaScript rather than using data attributesPlease note: I do not think this is a bug with this plugin but I am new to the plugin so maybe it is, or maybe it is just a configuration issue.
All help really appreciated.
Kind regards,
Ted Stresen-Reuter
- The topic ‘IMG elements wrapped in A elements don’t register click events’ is closed to new replies.