Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /data/sites/web/remonpelnl/www/wp-content/themes/remonpel_nl__child__twentyfourteen/functions.php on line 32
Google Tag Manager restart after AJaX page-reload – Remons TechNotes

Google Tag Manager restart after AJaX page-reload

Quick Tip

So you have this very fast AJaX page loader (InstantClick) on your website, but you want to use Google Tag Manager and track your pageview with Analytics etc; here’s how you reset Tag Manager and re-load it after your AJaX page is loaded;

InstantClick.on('change', function () {
jQuery('link[rel="canonical"]').attr('href', location.href);
ga = gaData = gaGlobal = gaplugins = google_tag_manager = dataLayer = undefined;
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],

Author: Remon Pel

WebDeveloper though not WebDesigner

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Confidental Infomation
stop spam mail