Skip to content

Commit

Permalink
Fixed missing event detail url (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
indykoning authored Dec 20, 2024
1 parent 94aa06e commit 99eb245
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions resources/js/gtm.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ window.sendDataLayer = function (func, ...args) {
}
}

document.addEventListener('vue:loaded', async (event) => {
document.addEventListener('vue:loaded', async () => {
if (!('dataLayer' in window)) {
return;
}
if (window.config.gtm['clear-on-load']) {
window.dataLayer = []
}

let url = new URL(event.detail.url);
let url = new URL(window.location.href);

ga4.pageView(event.detail.url);
ga4.pageView(window.location.href);

if (window.config.product) {
ga4.productView()
Expand Down

0 comments on commit 99eb245

Please sign in to comment.