New Shopify Certification now available: Liquid Storefronts for Theme Developers

Shopify Buy Button Tracking

2 0 2

I've been trying to get my purchases from a Shopify Buy Button on my website to be tracked. I wouldn't call myself a coder, but after some trial and error, I've gotten close! Need a bit of help to get it working perfectly.


1. I set up cross-domain tracking and added my main site to the blocked referral list


2. I added this snippet to the Additional Scripts section of my Shopify checkout section (replacing with my main website and UA code)

<script async src=""></script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('set', 'linker', {'domains': ['']});
gtag('js', new Date());

gtag('config', 'UA-XXXXXXXXX-X');
gtag('event', 'purchase', {transaction_id: {{checkout.order_number}}, value: {{checkout.subtotal_price}}, shipping: {{checkout.shipping_price}}});

When using Tag Assistant, I can see that it is pulling the order id #, the subtotal price, and shipping price. However, it is pulling it without the decimal, i.e. a $30.00 order is showing as $3000. Also, cannot get it to be able to pull a list of the line items.


Any help would be much appreciated!

Replies 2 (2)
Shopify Partner
25 0 14

Hi Ron,


Did you get any luck tracking your sales from the Shopify Buy Button?


For now Google Analytics sees someone who clicks "checkout" as a new direct visitor with no history, it's very frustrating to not be able to attribute the sales to the channel...


Any help is appreciated.

Shopify Expert
6 0 0

Hi, I have experience in conversion tracking on buy button, so if you are looking for help, just write me on,  regards Lubomir