Custom events
When a standard event name doesn't fit your business — fire any name via the pbq() function and AdsPing forwards it as a custom event to every connected destination. Each platform handles unknown names slightly differently; details below.
Firing a custom event
Use the global pbq() function (installed by pb.js) with any event name. Same signature as Meta's fbq():
pbq("track", "WhatsAppClick", {
value: 0,
currency: "USD",
content_name: "Hair Transplant Inquiry",
source: "footer",
});Or for tracking specific elements without writing wrappers, attach to a click handler:
document.querySelector(".whatsapp-btn").addEventListener("click", () => {
pbq("track", "WhatsAppClick", { source: "header" });
});pbq() very early in page load (before pb.js has finished loading), the call is queued and replayed once pb.js is ready — you don't need to check if window.pbq exists first.Naming guidelines
- Use PascalCase.
WhatsAppClick, notwhatsapp_click. Matches Meta and TikTok's standard event vocabulary. - Be specific but not too specific.
VideoPlayis fine;VideoPlay-product-42-on-page-3is not. Put fine-grained data in params, not the event name. - 50 character limit on Meta + TikTok. Names longer than 50 chars get truncated by the platform.
- Avoid spaces and special chars. Both platforms accept underscores; spaces and dashes can cause attribution issues.
How each platform handles them
Meta CAPI
Meta accepts any name. Custom events show in Events Manager under "Custom Events" tab once they accumulate ~10+ fires. They can be:
- Used as Custom Conversions for ad optimization (Events Manager → Custom Conversions → Create → pick your event).
- Used to build Custom Audiences (Audiences → Create → Website → pick the event).
- Reported in standard analytics (Events Manager → Overview shows custom event counts).
TikTok Events API
TikTok also accepts any name but has stricter standard names. If your custom event closely matches one of theirs (e.g. SubmitForm, ClickButton, Contact — all standard for TikTok), they'll be classified as standard events. Pure customs go under their generic "Custom" bucket.
Custom events can't be used directly for ad optimization — TikTok requires you to map them to a "standard event" first in Events Manager. To bid on a custom event, edit your Conversion Optimization in the campaign and pick the closest standard equivalent.
Google Ads
Google Ads doesn't track event names directly — it tracks Conversion Action IDs. To forward a custom event to Google Ads:
- Create a new conversion action in Google Ads (Tools → Conversions → + New).
- Add a Google Ads pipeline in AdsPing with that Conversion Action ID.
- Set Maps to pb.js event = your custom event name (
WhatsAppClick).
Now whenever you fire pbq("track", "WhatsAppClick"), AdsPing uploads to Google Ads using the configured action ID.
GA4
GA4 logs custom events directly with their snake_case form. AdsPing normalizes — WhatsAppClick becomes whatsapp_click in GA4. Custom events appear in Reports → Events after ~24h.
To use a custom event as a key conversion in GA4: Admin → Events → find your event → toggle "Mark as conversion".
Common patterns
WhatsApp / phone click
<a
href="https://wa.me/15551234567"
onclick="pbq('track', 'WhatsAppClick', { source: 'header' })"
>
Chat on WhatsApp
</a>Appointment booking
// Inside your appointment form submit handler:
pbq("track", "AppointmentRequest", {
content_name: "Hair Transplant Consultation",
appointment_date: "2026-06-15",
email: form.email.value,
phone: form.phone.value,
});Video engagement
videoElement.addEventListener("ended", () => {
pbq("track", "VideoComplete", {
content_name: "How AdsPing works",
video_duration: videoElement.duration,
});
});
videoElement.addEventListener("timeupdate", () => {
if (videoElement.currentTime > videoElement.duration * 0.5 && !fired) {
pbq("track", "VideoMilestone", { milestone: "50_percent" });
fired = true;
}
});Quote / pricing request
pbq("track", "QuoteRequest", {
content_name: "Enterprise plan",
estimated_value: 50000,
currency: "USD",
email: lead.email,
});Filtering — fire to one destination only
By default, every event fires to every configured pipeline. To scope a specific event to specific destinations, use pipeline filters:
- Pixel detail → pipeline list → pencil icon on the pipeline.
- Maps to pb.js event field — set to the specific event name. Only events matching this name will be forwarded through that pipeline.
- For multi-event pipelines (e.g. send Lead + AppointmentRequest to Meta but only Lead to Google Ads), create separate pipelines and configure each filter accordingly.
Next
- Standard event names — full list of pre-defined events.
- Event ingestion API — push from server-side code instead of pb.js.