appEventData
, for our data layer. Below is a code snippet to establish the data layer. appEventData
array if it exists, and create it if it does not exist. console.log(window.appEventData)
as shown below to see what the data layer looks like after these two pushes. {"event" : "Page Loaded"}
in the first push and {"event" : "Product Viewed"}
in the second push.event
but additional data may accompany the event. It is considered best practice to provide this additional data in a sub-object as shown above.event
key on the event object that is to be pushed onto the data layer.