I’ve looked all over but can’t find any information on how (if at all possible) to use a Variable value within a HTML Script?
I know we can use client.* to reference properties, but I’m unsure on if we can use a pre-defined variable in the same manner.
Thanks
Tom
Hey Tom! What do you mean by “pre-defined variable”? Can you provide an example?
If you’re referring that we call “system properties”, we need to update our docs with this information, but for now you can see this page: cloudflare-docs/properties-reference.md at ef8f289966af7afe523c816b7ab68be630b4335b · cloudflare/cloudflare-docs · GitHub
Sorry, I’m referring to Zaraz Variables as defined in this page:
Are we able to use these within a custom HTML block?
Thanks
Tom
Oh I see. Unfortunately there’s no easy way to use them now inside a Custom HTML tool, but if you’re feeling brave, try the following:
Get the ID of your variable by editing it and taking it from the URL in your browser (it’s the last UUID in the URL)
Use {{ variable.PUT_ID_HERE }}
in your code
Zaraz will replace it with your variable content
1 Like
jack26
April 10, 2023, 2:00pm
5
Hi @yoav_zaraz , does this method still work? Whenever I try to input a custom variable into a script tag I get console errors, and it doesn’t execute at all. The system variables work fine though.
It should still work, yes.
1 Like