Skip to content

Commit

Permalink
Merge pull request mautic#6782 from kuzmany/fix-send-page-view-queue
Browse files Browse the repository at this point in the history
Prevent call page view event with mt()
  • Loading branch information
dennisameling authored Mar 19, 2020
2 parents eea6462 + 292876a commit 0953324
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/bundles/CoreBundle/EventListener/BuildJsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ enumerable: false,
return matches;
}
}
MauticJS.ensureEventContext = function(event, context0, context1) {
return (typeof(event.detail) !== 'undefined'
&& event.detail[0] === context0
&& event.detail[1] === context1);
};
JS;
$event->appendJs($js, 'Mautic Core');
}
Expand Down
4 changes: 3 additions & 1 deletion app/bundles/PageBundle/EventListener/BuildJsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ function() {
// Process pageviews after new are added
document.addEventListener('eventAddedToMauticQueue', function(e) {
m.sendPageview(e.detail);
if (MauticJS.ensureEventContext(e, 'send', 'pageview')) {
m.sendPageview(e.detail);
}
});
})(MauticJS, location, navigator, document);
JS;
Expand Down

0 comments on commit 0953324

Please sign in to comment.