Search code examples
google-analyticsgoogle-tag-manager

Google tag manager doesn't track an image click


I have simple tag which tracks how many times an image was clicked. I use Click Classes inside the trigger and I have selected the image class name but it doesn't track anything and I don't know why. My Click Classes variable is enabled. The image appears few seconds after everything on the page is loaded, could that be the reason why it is not tracked? This is the guide I followed - https://pilotdigital.com/blog/how-to-track-clicks-with-google-tag-manager/


Solution

    1. Use preview.
    2. While in preview, click your image.
    3. After clicking, go to preview and confirm that the click event appeared on the left. Click the click event.
    4. Confirm that no tags fired on that click.
    5. While selecting the click event, go to variables.
    6. Find your Click Classes variable and see if it matches what you expect.
    7. Note that if the Click Classes variable contains more than your class and you used equals instead of contains in your trigger, it won't fire.

    After doing all this debugging you should be a step closer to why it's not firing as you expect.