Function declaration not found in custom variable body

Hi guys,

Have any of you ever encountered this problem?



Hi. Did you set up any Variables in your Tag Manager? Can you show your current setup?

Hi Kuba thanks for quickly jumping on this and yes I’ve got two custom JS variables:


Ok so it might come from these you think?


The first function does not look correct. How are you passing the URL? Instead of passing it as argument, you could simply define it inside the function via {{ Page Url }} or window.location.href.

Yes indeed but this pops the same issue even when passing the url straight in the function unfortunately I tried both: const matches = {{ Page Url }}.match(regex);

Here are some additional info from the console if this might help:


Just noticed one more thing. You should not define names for those functions. Use just:

function() {
 // your logic here

Thanks Kuba, I solved the console error message for the second function by using the DOM element variable from Piwik instead of the JS function even though the function works to get rid of the error. No more errors thanks again and this topic can be closed.