How to pull SKU data from website to Google Tag Manager

New Member
1 0 0

I'm using a javascript variable on Google Tag Manager to try and define the SKU variant of the product. Every statement I input to define the variable ends up with an "undefined" value when I make a test purchase in debug mode. 

I can find the order_id by using "window.Shopify.checkout.order_id." I assumed that if I'm able to find the SKU under "line_items" when I view the page source I can use a similar statement and define the SKU by "window.Shopify.checkout.line_items.sku". But this doesn't seem to work. I've also tried using "window.Shopify.checkout.line_items.variant.sku" and "window.Shopify.checkout.variant.sku." 

I'm not a developer and I don't know much about coding/JS but any advice about how I can implement the right code/statement to Google Tag Manager that will define the SKU will be greatly appreciated!

In reference to the screenshot: Variable (SKU) - Variable Type (JS) - Return Type (undefined) - Value (undefined)

Screen Shot 2021-03-09 at 10.30.42 AM.png

Replies 0 (0)