Lesson 4 of 9
Targeting Exactly One Event
Picking the event is half the job. Now you have to fire on only the case you mean. A generic form_submit fires for the newsletter box, the contact form and the demo request alike. If your conversion tag listens for "form_submit" with no further condition, every one of those becomes a demo lead. You need a discriminator: a value that is true for the case you want and false for the rest.
Where discriminators hide
- The event payload: a
formId,formNameorplankey already on the push. - The element: from
gtm.elementyou can read the form's id, classes,actionURL or adata-*attribute. - A hidden field: many forms carry a hidden
form_typeor campaign input you can scrape. - The page: if the demo form only lives on
/demo, Page Path is a perfectly good condition. - Button or link text: Click Text like "Request a demo" can separate two buttons that share an event.
Then the trigger is two conditions: the event, and the discriminator. For example, fire on Event equals form_submit and Form ID equals demo-request. Now it is genuinely specific.
When nothing distinguishes them
Sometimes two cases share an event and have no clean distinguishing key. Then you derive one. A Custom JavaScript variable can look at the element or URL and return a label; you trigger on that label.
function () {
var form = {{Click Element}}; // the submitted <form>
if (!form) return undefined; // guard: never throw
var action = (form.getAttribute('action') || '').toLowerCase();
if (action.indexOf('/demo') > -1) return 'demo';
if (action.indexOf('/contact') > -1) return 'contact';
return 'other';
}Clean up the messy values you find
Discriminators in the wild are rarely tidy: demo-request, Demo Form, frm_3 might all mean the same form. Don't scatter those raw strings through your triggers. Map them once with a Lookup Table (exact matches) or a RegEx Table (patterns) into one canonical name, and trigger on the clean output.
Key takeaway
To fire on one case, pair the event with a discriminator — a payload key, an element attribute, a hidden field, the page path or the click text. If none exists, derive one in a Custom JS variable, and normalise messy values through a lookup or RegEx table.