mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-05 04:12:53 +02:00
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:
parent
97faf7e6d9
commit
98ccb3725d
1 changed files with 6 additions and 0 deletions
|
@ -24,6 +24,12 @@ export default (function () {
|
||||||
// Always refer to the variable on window in-case it gets overridden elsewhere.
|
// Always refer to the variable on window in-case it gets overridden elsewhere.
|
||||||
window.gtag('config', trackingID, {
|
window.gtag('config', trackingID, {
|
||||||
page_path: location.pathname,
|
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,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue