I need to create a Google Tag Manager Javascript function that would return a label (group label) from a var entry that is a number (id of the group)
I created this function but it doesn’t work (returns undefined)
I’m really new with Javascript so I don’t understand what is wrong.
function client_group_name(id_client_group) {
var id_client_group = {{CONTEXT - User / Group / ID Default Group}}; //this is my GTM variable , numeric could take value 3, 5, 6 ,7 ,8 ,9 ,10 ,11
switch(id_client_group) {
case "3" :
value = "B2C";
break;
case "5" :
value = 'B2B Entreprises';
break;
case "6": case "7": case "8": case "9": case "10": case "11":
value = 'B2B Café, Hôtel, Restaurant - CHR'
break;
}
return value;
}
Google tag Manager Javascript functions need a function () and return statements to work.
Thanks for your help.
Best regards.