diff --git a/material/partials/integrations/analytics.html b/material/partials/integrations/analytics.html index c5a96f0c8..b048e5ad0 100644 --- a/material/partials/integrations/analytics.html +++ b/material/partials/integrations/analytics.html @@ -2,5 +2,5 @@ This file was automatically generated - do not edit -#} {% set analytics = config.google_analytics %} - + diff --git a/src/partials/integrations/analytics.html b/src/partials/integrations/analytics.html index c8820bfbd..85a42a98b 100644 --- a/src/partials/integrations/analytics.html +++ b/src/partials/integrations/analytics.html @@ -44,11 +44,12 @@ } }) } - }) - /* Send page view on document switch (instant loading, custom event) */ - document.addEventListener("DOMContentSwitch", function() { - ga("send", "pageview", document.location.pathname) + /* Send page view on location change */ + if (typeof location$ !== "undefined") + location$.subscribe(function(url) { + ga("send", "pageview", url.pathname) + }) })