Google Tag Manager Parse Error. Primary Expression

前端 未结 2 899
花落未央
花落未央 2021-01-22 04:25

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 express

2条回答
  •  情深已故
    2021-01-22 05:05

    All code in a custom javascript variable should be within function() {}, or you will get this error.

    Here's the documentation from Google:

    This field should be a JavaScript function that returns a value using the 'return' statement. If the function does not explicitly return a value, it will return undefined and your container may not behave as expected. Below is an example of this field:

    function() {
         var now = new Date();
         return now.getTime();   
    }
    

提交回复
热议问题