Optimizing Littledata’s Shopify tracking script for speed and accuracy

google analytics app featured in shopify app store

At Littledata we know that page load speeds are essential for ecommerce success, and we have made some major improvements to our Shopify apps this month to improve both page speed and data accuracy.

Having benchmarked over 20,000 ecommerce sites, and worked closely with larger DTC brands on Littledata Plus plans, we are well aware that technical factors such as page load speed are major drivers of ecommerce conversion rates.

We have always had a minimal, super-fast script and GTM data layer, but v9 brings this to a whole new level.

What’s new in LittledataLayer v9?

The need for speed is driving some of our customers to headless setups, but for many stores there are lots of optimizations to be had from their existing Shopify theme and apps.

Littledata’s main advance in this area is our server-side tracking, which means that our app has zero impact on your add to cartcheckout or payment steps. So the changes in v9 are focused on the landing pages, product listing pages and product details pages.

The latest update improves both page speed and the accuracy of the data we track

Some of the major improvements in LittledataLayer v9 are:

  • Tracking all product list impressions, on whatever pages they are displayed
  • The correct product variant is tracked, if the listing is for a specific variant
  • Products loaded after the initial page load (i.e. “lazy-loaded” products) will also be tracked
  • Listing pages of more than 50 products (e.g. infinite scroll pages) are tracked

In addition we’ve improved how some types of checkout are tracked, to ensure the marketing attribution of the order is correct, for:

  • Buy Now buttons leading to an accelerated checkout (e.g. Paypal, Google Pay)
  • Headless stores leading to a Shopify checkout
  • Custom checkouts which do not reuse the same Shopify cart token

See our help center for more details about how tracking product list views works as the user scrolls down the page.

All these changes will be automatically added for current customers, unless you opt out and choose manual updates, in which case you will need to manually upgrade. Please contact your account manager if you are unsure which option to take.

Note: Unless you opt for manual updates, we will now automatically update the snippet Littledata adds to your Shopify store

How does v9 of the Littledata tracking script improve page load speed?

To send accurate product list views, product list clicks and product detail views, our app builds a data layer containing all the products on the page. This is true for both our Segment app and our Google Analytics app in the Shopify app store. Building this data layer on Shopify’s servers took time before the page was ever seen by a user; in this improved version we get the product data after the user has interacted with the page.

This results in almost no impact to page load speeds from adding Littledata’s app, as measured by PageSpeed Insights – improving the score from 62% to 70%.

And yes, a score of 73 out of 100 is not very impressive…but for our test store we haven’t done all the good things you should be doing to optimize your store, like compression and lazy-loading of images. So whatever your page speed was before the improvements, it should be up to 10 percentage points higher now.

Speed test

So how did we make the latest snippet faster? To start, it’s no longer requiring the same liquid code.

We can see the difference using Shopify’s speed profiler extension for Chrome. Before the changes Shopify is spending over 80ms (out of 155ms total) processing the LittledataLayer snippet – and this test store does not have a particularly complex list of products.

After changing to v9, we see this has dropped to less than 1ms, because now all the product data is fetched asynchronously from Shopify’s APIs as the user interacts with the page.

The good news is that this comes at no cost to data accuracy. Our script already tracked the product impressions after the page load – now we wait to get the product data until it is really needed.

As a key part of the modern data stack for DTC brands, we are always investing in efficiency and accuracy at Littledata. Schedule a demo to learn more, and let us know if you have suggestions for further technical improvements!

How to get complete ReCharge data in Google Analytics [ebook]
subscription selling

How to get complete ReCharge data in Google Analytics [ebook]

It’s hard enough for Shopify stores to get accurate sales and marketing

Property and destination updates in our Shopify source for Segment
connect segment and shopify littledata shopify app

Property and destination updates in our Shopify source for Segment

Over the last 6 months, we’ve continued to enhance Littledata’s Shopify source

You May Also Like