Search code examples
javascripthtmlgoogle-tag-managergoogle-analytics-4

Google Tag Manager Fires Tags in Preview (Debug) Mode, but Not on the Live Site


I have added a custom HTML class to the div and innermost span (the text) of a button.

When this button is clicked in the preview (debug) mode, the event fires, and the real-time Google Analytics stats update accordingly.

When I click the same button outside of preview mode, it does not reflect on Google Analytics.

I have tried multiple browsers (Chrome, Chrome Incognito, Opera, Edge) (without any browser extensions) and a different computer and network, but none trigger the tag.

The class is on the live site outside of the preview mode.

Any help will be greatly appreciated - thanks in advance!


Solution

  • You're supposed to publish your workspace for it to work without preview.

    Also, it's not good to use Click Classes. It's better to use Click Element -> Matches CSS Selector -> .calendy-consult-edwards, .calendy-consult-edwards *

    Also, having pure JS in onclicks is not a good practice. Mixing languages leads to confusion.