How to fix 'Invalid JSON: unexpected token' error on Dawn theme?

I am trying to add code in my Dawn theme for web tracking.

Klaviyo says to enter this code into the product.liquid template.

I have been trying to add this into the product.json (as I think that is the equivalent of product.liquid), but then I get the error of “Error: Invalid JSON: unexpected token”.

Any help would be greatly appreciated.

You cannot add it in the product.json file, as it only accepts a schema written in json format. It should be added in a file ending in .liquid in order for it to be executed. I you do not have a specific product.liquid file, in the product.json template, you can find the main section that appears on your page in that template: bellow “sections”, the first type that appears is most likely to be the central section in your product page. For instance, here it is called “product-form.liquid”:

Find the file with that name ending in .liquid and paste the code bellow all the code, but above any {% schema %} tag, and it should be enough.

1 Like

Thanks a lot, your answer is really helpful to me. :grin:

Hello, I try to add this html code and get this response:

What i’m dpoing wrong ?

Thank you