Track any action on your site with a few lines of code. Your events go to Facebook, TikTok and GA4.
A custom event is any action you can detect on your page: a VSL watched to 50%, a button clicked, a checkout page reached. You paste a short snippet on your site and the event shows up in TrueMetriks and is sent to Facebook, TikTok and GA4 under the name you choose. Google Ads only takes the standard events, so custom events are not sent there.
Not a coder? Copy one of our AI prompts below into ChatGPT or Claude, describe what you want to track, and paste the code it gives you.
The same TrueMetriks code you added during setup. Nothing new to install.
In the same place: GoHighLevel tracking code, ClickFunnels head code, your WordPress header, or your site's HTML.
It appears under Conversions in a few minutes and goes to every Facebook, TikTok and GA4 connection.
<script>
/* TrueMetriks: send a custom event. Waits for the tracker, once per page. */
window.tmTrack = window.tmTrack || function (name, details) {
var sent = (window._tmFiredEvents = window._tmFiredEvents || {});
if (sent[name]) return;
sent[name] = true;
var tries = 0;
(function send() {
if (window.tmFireEvent) window.tmFireEvent(name, details);
else if (window.Shopify && Shopify.analytics && Shopify.analytics.publish)
Shopify.analytics.publish("tm_custom_event", { name: name, details: details || {} });
else if (tries++ < 50) setTimeout(send, 200);
else delete sent[name];
})();
};
</script>Every example below starts with this helper. It waits until your tracker has loaded and sends each event name once per page, so a reload loop or a busy scroll never floods your reports.
Click one to see the code and an AI prompt for it.
25%, 50%, 75% and finished
<script>
/* TrueMetriks: send a custom event. Waits for the tracker, once per page. */
window.tmTrack = window.tmTrack || function (name, details) {
var sent = (window._tmFiredEvents = window._tmFiredEvents || {});
if (sent[name]) return;
sent[name] = true;
var tries = 0;
(function send() {
if (window.tmFireEvent) window.tmFireEvent(name, details);
else if (window.Shopify && Shopify.analytics && Shopify.analytics.publish)
Shopify.analytics.publish("tm_custom_event", { name: name, details: details || {} });
else if (tries++ < 50) setTimeout(send, 200);
else delete sent[name];
})();
};
/* Works for an HTML5 <video>. For YouTube, Vimeo or Wistia, use the AI prompt. */
var video = document.querySelector("video");
if (video) video.addEventListener("timeupdate", function () {
if (!video.duration) return;
var pct = video.currentTime / video.duration * 100;
[25, 50, 75, 100].forEach(function (m) {
if (pct >= m - 0.5) tmTrack("VideoWatched" + m);
});
});
</script>Google Ads is left out on purpose: it only counts the standard events (Lead, Purchase and so on) as conversions. You can switch your events off per pixel with the Your own events switch under Settings - Tracking.