fix: properly initialize CMP, GTM and data layer for tracking
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { Controller } from '@hotwired/stimulus';
|
||||
|
||||
export default class extends Controller {
|
||||
static values = {
|
||||
url: String,
|
||||
title: String,
|
||||
userInfo: String
|
||||
};
|
||||
|
||||
connect() {
|
||||
if (typeof window.dataLayer !== 'undefined') {
|
||||
window.dataLayer.push({
|
||||
'event': 'VirtualPageview',
|
||||
'virtualPageURL': this.urlValue,
|
||||
'virtualPageTitle': this.titleValue,
|
||||
'userInfo': this.userInfoValue
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user