fix: streamline datalayer integration for all events
This commit is contained in:
@@ -2,19 +2,12 @@ import { Controller } from '@hotwired/stimulus';
|
||||
|
||||
export default class extends Controller {
|
||||
static values = {
|
||||
url: String,
|
||||
title: String,
|
||||
userInfo: String
|
||||
payload: Object
|
||||
};
|
||||
|
||||
connect() {
|
||||
if (typeof window.dataLayer !== 'undefined') {
|
||||
window.dataLayer.push({
|
||||
'event': 'VirtualPageview',
|
||||
'virtualPageURL': this.urlValue,
|
||||
'virtualPageTitle': this.titleValue,
|
||||
'userInfo': this.userInfoValue
|
||||
});
|
||||
window.dataLayer.push(this.payloadValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user