I am trying to save this Custom Javascript Variable within Google Tag Manager and return this error each time:
Error at line 2, character 4: Parse error. primary expression expected
var prodID = function pID() {
return document.querySelector(".no-display > input[name=product]").value;
}();
Can someone help me? I believe I have a primary expression.
To fix the issue in Google tag manger, I simple re wrote the code to be :
function() {
  return document.querySelector(".no-display > input[name=product]").value;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With