DataLayer

Highlighted
New Member
1 0 0

Hi all,

I have encountered an issue with a custom dataLayer which refuses to load on all collection pages. What I've found so far is that on those pages, window.jQuery returns undefined (while the dataLayer waits for jQuery to load).

I've tried adding the following

{{ '//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js' | script_tag }}
{{ 'api.jquery.js' | shopify_asset_url | script_tag }}

and this loads the jQuery library, but still doesn't execute the dataLayer. The dataLayer is contained in a snippet and accessed from the <head> of the theme.liquid file.

{% include 'dataLayer-allPages.liquid' %}

The custom dataLayer documentation can be found here:

https://github.com/TechnicalWebAnalytics/dataLayer-shopify

 

Here is an example where the dataLayer doesn't initialize: https://altmarkt.ro/collections/beverages

Here's an example where it initializes correctly: https://altmarkt.ro/collections/bacanie

 

Any help will be greatly appreciated!

Thank you,

Andy

0 Likes