I have the same issue. On my site, it looks like the problem is in “ecomm_totalvalue”:value. As soon as i know, the value should be quoted, like this: “ecomm_totalvalue”:”value”.
Hi Jeff,
You are getting a false positive error. Tag Assistant parses the add-to-cart event JS code. It includes unquoted parameters that can not be quoted since it would break the code.
Regarding the second question: it is hard to tell you what could be the reason. If you are open to give me read only access to your GTM account please contact me using the contact form of duracelltomi.com
@mediakov: I do not think this is the reason but we will see.
Cheers,
Thomas Geiger
Unquoted parameters cannot be quoted since it would break the code.
But google says that if you have any other character apart from alpha numeric and underscores you may run into problems.
Also you cannot use reserved words like function…
Quoted from: https://support.google.com/tagassistant/answer/3207128?hl=en&ref_topic=2947092#dl_quoted
Data layer fields should be quoted
While quotes are not strictly required for variable names that consist of only letters, numbers, and underscores, and which are not reserved words (e.g. function, export, native, etc.), to avoid issues, it”s recommended that all variable names be enclosed in quotes. Examples: dataLayer.push({new-variable: “value”}); // Won”t work dataLayer.push({“new-variable”: “value”}); // Better
I often use hiphen and colon in product names, should it affect my tags in any way?
Thanks for the plugin!
Every variable name in my plugin is quoted however if you enable WooCommerce integration for example there will be some added code that assigns values to those variables dynamically.
I can not quote a JavaScript code since it would not execute when quoted:
'productSKU': $( this ).data( 'product_sku' )
I can not quote the value since it is a function call but Tag Assistant parses this line as well and reports a “Suggestion” warning.
Some datalayer variables are integer values that does not need to be quoted. In my experience when a datalayer variable name is quoted but the integer value is not, Tag Assistant does not report any issue. Hyphens and colons should not be a problem since they are escaped while adding them to the datalayer.