Add stimulus controller to trigger GTM datalayers
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
|||||||
|
import { Controller } from 'stimulus'
|
||||||
|
|
||||||
|
export default class extends Controller {
|
||||||
|
|
||||||
|
static values = [ 'event' ]
|
||||||
|
|
||||||
|
trigger() {
|
||||||
|
window.dataLayer = window.dataLayer || []
|
||||||
|
dataLayer.push({
|
||||||
|
'event': this.eventValue,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user