fix(v2): GTM, send page_view events on navigate (#3243)

* fix: update pageviews for Google Tag Manager

* fix prettier issues

Co-authored-by: govardhan <govardhan.s@mobinius.com>
This commit is contained in:
Govardhan S 2020-08-12 14:38:22 +05:30 committed by GitHub
parent 97faf7e6d9
commit 98ccb3725d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,12 @@ export default (function () {
// Always refer to the variable on window in-case it gets overridden elsewhere.
window.gtag('config', trackingID, {
page_path: location.pathname,
page_title: document.title,
});
window.gtag('event', 'page_view', {
page_title: document.title,
page_location: location.href,
page_path: location.pathname,
});
},
};