How Do I Use Gleam to Track Custom Actions With JavaScript?
You track custom events with a tracking script, not a gleam.track() call. The Custom Action sets the tracking name, and your page fires it with Gleam.push.
- In your Competition, open the How to Enter tab and add a Custom Action.
- Give it a unique tracking name, like
VIP. Use a different name for each tracked Action, or you'll mix up your tracking. - Copy the tracking script Gleam generates. It's unique to your campaign. Place it in the
<head>of the page where the event happens. - When the event occurs, fire the trigger:
window.Gleam = window.Gleam || [];
Gleam.push(['VIP', 'myValue']);
The second value is optional. It appears in the Details column on your Actions tab, which helps with de-duplicating or noting an order ID. To send several values, pass arrays together, and to know when tracking has sent, pass a callback function.
The Action then completes by itself, even if the entrant has left the landing page. You can enable Allow question or tracking as a fallback.
Custom Actions are a Business Plan feature and above, so check pricing. Full details are in Custom Action Tracking.
See Next Article
Does Gleam Provide API Logs or Debugging Tools?
Yes. You can view tracked actions inside the Gleam campaign dashboard under the Actions tab. Click to learn how to monitor and debug your API-based tracking events.