Please try using {{ Event }} instead of {{Custom Event}}.
{{ Event }} is a built in variable which returns the value of the event key in the dataLayer.
that worked. But I still get a console error Cannot read properties of undefined (reading ‘indexOf’).
any ideas?
it seems on the initial load that the variable is undefined. The error accures just once and the rest is as it should be
Just to make sure, this code is in a tag or a variable? -
function(){
var vpu = “Fallbackrechner”;
if ( {{Custom Event}}.indexOf(“rlv”) == 0 ){
vpu = “Angebotsrechner Risikoleben”;
} else if ( {{Custom Event}}.indexOf(“pkw”) == 0 ){
vpu = “Angebotsrechner PKW”;