Product Sizes Showing In Google Analytics

Hi All,

I have a question that I’m hoping to resolve. We’re finding that the product sizes are showing up individually in GA (e-commerce) for the same product.

As you can see below, the same product URL is coming through for each of the different sizes in GA. This splits the revenue across each size, but we only want the total revenue for all sizes for the same product.

The issue seems to be the size variants. If we click on size, the URL (variant) changes, so from Google’s perspective, will they pull this in individual URLs for each of the product sizes?

For example

XS
https://montirex.com/collections/shorts-1/products/grey-fly-short-368546-014?variant=39257466503254

S
https://montirex.com/collections/shorts-1/products/grey-fly-short-368546-014?variant=39257466536022

M
https://montirex.com/collections/shorts-1/products/grey-fly-short-368546-014?variant=39257466568790

The variant= parameter changes the last 5 digits.

unnamed (3).png

The colour variants will still come through because they have their own URL.

I’ve excluded the URL parameter in GA but I’m not sure if this will remove the URLs under the e-commerce tracking.

I’ve asked for a second opinion on LoveData and he seems to think the tracking might be using {{ line_item.title }} – https://shopify.dev/api/liquid/objects/line_item#line_item-title – when sending the product name to Google Analytics.

We could try changing this to another object like {{line_item.product.title}} and see if this fixes the issue.

However, my development knowledge of Shopify is limited, so any help will be greatly appreciated.

Thanks,
Danny

Hi @DannyH ,

I checked, and these products have the same name, but it is different products, and the product link is different.

So you need to double check the product names.

Hope it helps!

Hi,

Thanks for the reply, I really appreciate it. I’m aware that the URLs are different for the same product with multiple colours. It’s when you select a particular size that the URL variant changes for the same colour.

Thanks,

Danny

Danny

Hi @DannyH ,

I checked and the URLs are different, it’s like you have many different products instead of one.

Because I try to get data JSON, all products are different, it uses a different id.

Can you check the product list at admin?

Hope it helps!

Hi,

I’m a little confused? I know the URLs are different for each colour, that’s not the issue. The issue is when you select a size, it changes the URL variant and reports it in Google Analytics (Product Performance individually, not collectively)

The permalinks are different, so no issues there, just the sizes. I just don’t know how to exclude these.

I’ve checked the product list in Admin and there are colour variations for each URL - which is fine.

Apologies if I’ve misunderstood anything.

Thanks,

Danny

Hi @DannyH ,

When you change variants, it will show different URLs according to “url?variant=id-variant” structure which is Shopify default structure. You can check all Shopify sites, they will all have the same structure.

If you want to remove it, please go to theme.js file, find ‘window.history’ and remove the code here:

Hope it helps!

Ahhh okay, I’m worried about breaking the theme if I try this. I’ll see if I can test this via staging before making the move.

Thanks for your help. I’ll see how I get on.

Thanks,

Danny

Hi @DannyH ,

If it helped you solve your issue, please mark it as a solution. Thank you and good luck.