21 lines
525 B
JavaScript
21 lines
525 B
JavaScript
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
|
|
});
|
|
}
|
|
}
|
|
}
|