Skip to content

Super simple tracking script to track certain user interactions on my personal site. I add a clic eventListener to the body object and a callback event handling function. When selected events take place, a defined dataLayer.push() call is executed to populated the Google Tag Manager (GTM) dataLayer with certain params.

Notifications You must be signed in to change notification settings

temphoyos/tracker.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

tracker.js

Super simple tracking script to track certain user interactions on my personal site. I add a click eventListener to the document object and a callback event handling function. When selected events take place, a defined dataLayer.push() call is executed to populated the Google Tag Manager (GTM) dataLayer.

Additionally, this script handles the following GA4 Enhanced Ecommerce (EEC) event dataLayers:

-view_item_list This event is pushed to the GTM dataLayer when either the home or category pages are displayed
-select_item This event is pushed to the GTM dataLayer when a user clicks on any of the blog posts listed on the home or category pages
-view_item This event is pushed to the GTM dataLayer when a blog post is displayed
-add_to_cart This event is pushed to the GTM dataLayer when a user scroll reaches 50% of the height of a blog post
-purchase This event is pushed to the GTM dataLayer when a user scroll reaches 100% of the height of a blog post

About

Super simple tracking script to track certain user interactions on my personal site. I add a clic eventListener to the body object and a callback event handling function. When selected events take place, a defined dataLayer.push() call is executed to populated the Google Tag Manager (GTM) dataLayer with certain params.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published