Don't have one? Create one ↗
← All courses

Lesson 1 of 7

Custom Event Basics

① Connect your GTM container

Paste your container ID to load it into this page. It only ever runs here.

Advanced: use a specific environment

Clicks, scrolls and page views are things GTM can see for itself. But "the newsletter signup actually succeeded" is something only your page knows. The way it tells GTM is a dataLayer push: a small line of code that announces an event by name.

You catch that announcement with a Custom Event trigger. The button below pushes { event: "newsletter_signup" }; your job is the trigger that listens for exactly that name and the tag that fires on it. This is the pattern behind nearly every meaningful conversion you'll ever track.

Goal

Build a Custom Event trigger for newsletter_signup and fire a tag on it.

Build it in GTM

  1. Know what the page pushes

    The site already runs dataLayer.push({ event: "newsletter_signup" }) when the signup completes (on a real site your developer adds this line). GTM sees that as an event named newsletter_signup.
  2. Create the Custom Event trigger

    Go to Triggers → New and choose Custom Event. In Event name, type newsletter_signup, it must match the pushed string exactly, including case and underscores.
  3. Fire a tag on it

    Create your conversion tag (a GA4 Event tag named newsletter_signup on a real site; here the Custom HTML - Test stand-in with <script></script> is fine) and set this trigger as its firing trigger.

Debug in Tag Assistant

Copy this lesson's live URL and paste it into GTM Preview, that is the page Tag Assistant connects to. It has the clickable elements, so this page stays clean for reading.

  1. In your GTM, click Preview.
  2. Paste the live URL above and click Connect.
  3. Interact with the live page and watch your tag fire in Tag Assistant.

What you should expect to see

Click Sign up on the live page. In Tag Assistant a newsletter_signup event appears in the left rail, and your tag shows under Tags Fired. No click before the push means no fire, the event is the signal.

Verify your container

Built it? Export your container, Admin → Export Container, choose your workspace, then drop the JSON here to check it against this lesson.

Drop your container .json here

or browse · checked in your browser, nothing is uploaded

0 of 7 lessons complete