📊Tracking Custom Events in Mixpanel
Last time, we walked through how to set up Mixpanel using the init
tag. That setup included turning on Autocapture, which gives you a useful baseline — things like page views, button clicks, and form submissions — without needing to configure anything manually.
But as helpful as that is, in most real-world cases, it’s not enough. You’ll often want to track specific actions your users are taking — and that’s where custom events come in.
Let’s break that down together with a practical scenario.
The first step is to set up a Trigger in Google Tag Manager. A trigger simply tells GTM when a tag should fire. There are different types of triggers depending on the interaction or condition you're trying to track from basic page views and clicks to more specific actions like form submissions, element visibility, or even YouTube video plays.
It’s actually a long list, but for now, let’s focus on one of the most common and easiest to use: the Page View trigger.
Let’s say you want to track signups on your site. The best way to do this is to have a dedicated thank you page that users are redirected to after signing up.
Note: It doesn’t have to be a traditional thank you page. It just needs to be a page that’s only accessible after someone has signed up.
Once that’s in place, go into GTM → Triggers → New, and give your trigger a name. Something like Signup – Thank You Page View
works well.
Choose the Page View trigger type, and under “This trigger fires on,” select Some Page Views. You don’t want this firing for every single page.
Now you’ll set up a condition to target just the thank you page. You can use a variable like:
{{Page Path}}
- this refers to everything after your domain, like /thankyou{{Page Hostname}}
-the domain name itself{{Page URL}}
- the full URL
In this case, choose Page Path
, set the condition to contains, and enter /thankyou.
This tells GTM to fire the trigger only when someone lands on that specific page.
Once your trigger is ready, it’s time to create the tag.
You might already be familiar with this from setting up tags for Google Analytics or Mixpanel’s base setup. This time, we’re creating a custom event tag.
Go to Tags → New, choose Tag Configuration, and select Mixpanel.
For the Tag Type, select Track.
Under Event Name, enter something like Signup Completed
or anything that makes it easy to identify later.
Then, under Triggering, choose the thank you page trigger you just created.
Give your tag a name something like Mixpanel–Signup Completed and save it.
Once everything is saved and published, you should be good to go. The event might take a few minutes to show up in Mixpanel, but sometimes it can take a few hours or up to a day.
Go to your Mixpanel dashboard and check if the event is firing. You should start seeing data soon after people complete the signup process.
And if anything feels off or you’re not seeing the event show up, feel free to reach out. I’m happy to help troubleshoot.