x

Checkout tracking variables

I am attempting to set up a GTM datalayer on the checkout page for square.online.  It gives me a list of variables that I can use on the "Tracking Tools" page in the admin.  They are:


You can use the following variables to fill in order details:

  • {txid} - Transaction id
  • {orderid} - Square Order id or order token
  • {storeName} - Store name
  • {tax} - Tax value
  • {shipping} - Shipping value
  • {subtotal} - Order subtotal value
  • {total} - Total order value
  • {name} - Customer name
  • {email} - Customer email
  • {items} - Order items

But when I add them to my code the only one that gets populated is `storeName`.  Here is the code I am attempting to add:

window.dataLayer = window.dataLayer || [];
dataLayer.push({
'event': 'purchase',
'storeName': '{storeName}',
'txid': {txid},
'orderid': {orderid},
'name': '{name}',
'email': '{email}',
'total': {total},
'subtotal': {subtotal},
'shipping': {shipping},
'tax': {tax},
'transactionProducts': {items}
});

 

Am I not adding them correctly?  It seems like I am since the storeName does get correctly populated, but none of the other variables.  Do I need to turn them on in some manner?  Sorry the documentation is extremely spartan on this topic.

1,307 Views
Message 1 of 4
Report
3 REPLIES 3

Bumping this up as I'm interested in know this, too.

1,190 Views
Message 2 of 4
Report
Square Community Moderator

Hello @CourageCalling and welcome to the Seller Community. 

 

Wanted to reply here so your first post didn't fall through the cracks. Your best luck getting an answer to this complex question, will be at our Developer Forums. While some of our Sellers may know a bit of programming. Most of them are Sellers/Business Owners and not dedicated developers like you. 

 

When you have a moment take a peek at our Developer Forums and ask away.

JJ
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
1,148 Views
Message 3 of 4
Report

Bumping again, this is a real issue and no one is clarifying it on the developer forums. Did you find the solution @farlandlee ?

1,096 Views
Message 4 of 4
Report