1
votes

I am sending events to Google Tag Manger via the dataLayer like so:

{"event":"module_email_activate"}

And the tags always have a logic to them like {category}{action}{label} can I set the Analytics Event is triggered with the category, action and label set dynamically from these parts? I have already set up the trigger to fire based on regex and I can set the Analytics category action or label to the full text of the tag action btu can I get some modifiers on it or use the matches in the trigger?

1

1 Answers

3
votes

One way would be to have three similar structured custom javascript variables that return part of the event name (which is accessible as variable itself)

E.g. for the "module" part:

function() {
  var parts = {{Event}}.split('_');
  return parts[0];
}

and return parts[1] and parts[2] for the subsequent bits.