Skip to content

webhasan/gtm-datalayer-for-shopify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ultimate Shopify DataLayer for Google Tag Manager

👉 Contact me for support:

Email: [email protected]

Whatsapp: +8801723770763

Linkedin: linkedin.com/in/md-h/

How to use:

  1. Go to theme edit and paste GTM tracking code right after <head> tag in theme.liquid file
  2. Inside the snippets folder create a new file as ultimate-datalayer. Copy all of the code from ultimate-datalayer.liquid of this repository to sinppet file ultimate-datalayer.liquid.
  3. In the theme.liquid file after your GTM tracking code include ultimate-datalayer.liquid file as {% render 'ultimate-datalayer' %}
  4. From your Shopify Admin Dashboard, navigate to Settings → Customer events. In the top-right corner, click Add custom pixel to create a new custom pixel. Next, enter a title for the pixel and create it. Remove all commented code from the code editor. Then, copy the entire code from the GitHub file checkout-webpixel.js and paste it into the code field of your new custom pixel. At the very top of the code, replace the sample GTM Tracking ID GTM-00000000 with your actual Google Tag Manager ID. If you’re using server-side tagging with a custom domain, update the Tag Manager URL to match your website’s subdomain.
  5. In the Customer privacy settings section - For the Permission option, select Not required – The pixel will always run and for the Data sale option, choose Data collected does not qualify as data sale.
  6. Finally, click connect button in the top right corner to connect custom pixel.
  7. Depending on your Shopify theme, you might have to make some adjustments. For more information, please refer to the video below.

Events Included!

  1. view_item
  2. view_item_list
  3. select_item
  4. add_to_cart
  5. remove_from_cart
  6. view_cart
  7. view_item_list
  8. begin_checkout
  9. add_to_wishlist
  10. add_payment_info
  11. add_shopping_info
  12. purchase
  13. contact_form_submit
  14. newsletter_signup
  15. search
  16. phone_number_click
  17. email_click
  18. Logged customer and on the checkout page customer details included as customer object with dataLayer
  19. Event Parameters: currency, value, transaction_id, coupon, shipping, vat, items, item_list_name, item_list_id
  20. Items Parameters item_id, item_name, quantity, price, discount, item_brand, item_category, item_variant, sku, item_list_name, item_list_id

Features

With all general event tracking it also tracks following special events

  1. DataLayer event prefix
  2. Quick View Event Tracking (as view_item)
  3. Mini Cart and Dropdown Cart, Cart Drawer Tracking (as view_cart)
  4. Shopify Direct Checkout Tracking ( as add_to_cart & begin_checkout)
  5. Sticky Cart, Sidebar Cart, etc Tracking ( as add_to_cart)
  6. Shopify Ajax Search Tracking ( as search )
  7. Events was tacked by Ajax Response so no data discrepancy for edge cases
  8. No jQuery, no 3rd Party Scripet was included, all code was written ES6 Object Oriented Way. Added proper error handling so that there is no JS error

Testing

Follow the Link For Details

For more information, please watch the video below.

About

GTM data Layer for Shopify ecommerce

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published