javascript - Google Tag Manager Dynamic Function -


is there knows how use dynamic function in gtm. ex create new variable(custom javascript in gtm) called getname , take 1 parameter.

function(name)  {    console.log(name);    return;  } 

now, want create new custom javascript. , call getname function. not call it. think using wrong syntax.

  function()   {    {{getname("test")}} => not worked    {{getname "test"}}  => not worked     return;   } 

is there knows how call function in gtm. thanks

you try this:

your first function return name:

function(){     return function(name){         console.log(name);         return;     } } 

and call this:

function(){     var getname = {{getname}};     getname("test");     return; } 

whatever in double curly braces name of macro itself, , outside of can called regular function. if want use them in an event tag example, need supply return value.


Comments