-1

I need to measure page load time of my web page so i installed Google Tag Manager on it.

On the web of Google Tag Manager y did the required configurations an some time later I saw the data on the charts, but the page load time variable was undefined.

To simplify things, I rewrote the Custom Variable Javascript Function to a simple one: function(){return 1;} And it still returns undefined The example function from the tool tip does same.

I check the value using the preview mode and i do see how it updates when reloading my web page.

I tried more functions and changing the triggers, in a different PC even.

If I change the Custom Variable type from Javascript Function to a Constant type, for example, it does works, but when using Javascript Function, it does not, always undefined.

1 Answer 1

0

Do you have a CSP header set on your site? If you do, then you must set he 'unsafe-eval' directive in the script-src section of your CSP. If you don't do this, all custom Javascript variables set in Tag Manager will evaluate to undefined.

https://developers.google.com/tag-platform/security/guides/csp#custom_javascript_variables

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.