Courses / SEO‑Friendly Custom 404 Page with Analytics & A/B Testing
Lesson 5 of 9

Tracking Custom Events on the 404 Page

5
▶

Video by Google Analytics on YouTube · 10 min. We did not make this video and we do not host it — watching it here still counts as a view for the creator.

Use gtag('event', 'click', { 'event_category': '404', 'event_label': 'cta_home' }) to log button clicks. Beginners often forget to wrap the call in a function that runs after the script loads, leading to “gtag is not defined” errors.

In practice, these events let you compare how users interact with different variants. Ensure the event names are consistent so you can filter them easily in GA reports.

Start learning free

Sign in with your email, Google or GitHub. No password to remember. The same account carries your progress, your certificates and anything else you do with Nexgino later.

Sign in to continue

It takes about fifteen seconds.