How to Improve Collection Page Speed on GTM Suite

Some custom catalog implementations can see site speed issues - see how to put a fix in.

We've had reports of some themes that see a slower than normal time to first byte on collection pages after installing GTM Suite app.

Generally, this is due to a conflict of the way our dataLayer builds out your entire collection/product object variables. For example - if you have an infinite scroll we will load every single product.

We have two options for this:

  1. Modifying part of collection liquid logic to force limit of products
  2. Commenting out completely

Option 1: Modify Liquid Logic

In your theme go to the elevar-body-end.liquid snippet and go to ~ row 314 to find if template .name == "collection"

Then replace this block of code circled below:

collection-old

With this:

var visibleProducts = [];

var productLimit = 36;

Array.prototype.slice.call(document.querySelectorAll('a[href*="/products/"]')).slice(0, productLimit).forEach(function(item) {

Which should then look like this:

collection-new

You can change the 36 in the code to anything you'd like - this is the number of products returned.

Once done then click save. You should then be good to go.

Option 2: Comment Out

If you'd prefer to comment out completely then do this:

Include here:

Screen Shot 2019-05-07 at 8.36.59 PM

 

Then include here:

Screen Shot 2019-05-07 at 8.37.10 PM

Then save.

If you have any additional issues or questions please let us know!

 

Back to Top 🔝