miguel-perez / smoothState.js

Unobtrusive page transitions with jQuery.
MIT License
4.43k stars 508 forks source link

Google Tag Manager not working on smoothstate pages #377

Open lkpatricia opened 5 years ago

lkpatricia commented 5 years ago

I am installing google tags on a site that uses wordpress and smoothstate transition animations. When I navigate between scene elements using smoothstate (which are each unique wp pages), my GTM's do not fire. If I do a hard refresh of one of those pages, the GTM's will fire until I navigate to another scene element.

Here is an example of a listener that is not working: $( '.back-to-home' ).on('click', function() { if (typeof dataLayer !== 'undefined') { dataLayer.push({ 'event': 'backToHomeClicked', }); } });

How can I keep the listener enabled?