Track events
Track Purchase
Fire Purchase when a visitor completes an order — usually on the “Thank you for your order” page. This is the most important event for Meta: it tells Smart Bidding which clicks lead to revenue.
Quick start
One call on your order-confirmation page, anywhere after pb.js is loaded — this alone is a working Purchase event:
adsping('track', 'Purchase', {
value: 24.90,
currency: 'USD',
order_id: 'ORDER-9381'
});Every extra field you add raises your Event Match Quality — the full payload below reaches EMQ 10/10.
Full example
Pick the tab for your stack — they all send the same event.
<script>
adsping('track', 'Purchase', {
content_ids: ['SKU-1043'],
content_type: 'product',
contents: [{ id: 'SKU-1043', quantity: 1, item_price: 24.90 }],
num_items: 1,
value: 24.90,
currency: 'USD',
order_id: 'ORDER-9381',
email: '[email protected]',
phone: '+1 415 555 1234',
firstName: 'Jane',
lastName: 'Doe',
city: 'San Francisco',
state: 'CA',
zipCode: '94107',
country: 'US',
dateOfBirth: '1990-01-15',
gender: 'f',
externalId: 'crm-12345'
});
</script>- HTML — place the snippet in the
<body>of the confirmation page, after the AdsPing script, and fill the values from your order data. - React / Next.js — render
<PurchaseTracker />on your thank-you page; theuseEffectfires the event once when the page loads. - Google Tag Manager — paste the HTML snippet into a Custom HTML tag, triggered on your order-confirmation page.
- Send a field only when you actually have it. AdsPing SHA-256-hashes every personal field before it reaches Meta.
Parameters
| Field | Type | Description |
|---|---|---|
valuerequired | number | Gross order total.24.90 |
currencyrequired | string | ISO-4217 code.USD |
order_idrecommended | string | Your order id — enables cross-channel dedup.ORDER-9381 |
content_ids | string[] | Array of product SKU strings.['SKU-1043'] |
content_type | string | 'product' or 'product_group'.product |
contents | object[] | Line items as { id, quantity, item_price }.[{ id: 'SKU-1043', quantity: 1, item_price: 24.90 }] |
num_items | number | Total item count.1 |
| Field | Type | Description |
|---|---|---|
emailrecommended | string | Email address, any case. The strongest match signal. |
phonerecommended | string | Any format — AdsPing normalizes it to E.164 by country.+1 415 555 1234 |
firstName | string | Given name, plain text.Jane |
lastName | string | Family name, plain text.Doe |
city | string | City name, plain text.San Francisco |
state | string | State / region code.CA |
zipCode | string | Postal / ZIP code.94107 |
country | string | ISO-3166 alpha-2 code.US |
dateOfBirth | string | YYYY-MM-DD.1990-01-15 |
gender | string | 'f' or 'm'.f |
externalId | string | Your own customer / user id, from your CRM or auth session.crm-12345 |
| Field | Type | Description |
|---|---|---|
fbp / fbc | string | Meta browser cookies — read by pb.js, fbc even built from ?fbclid= in the URL. |
client_ip_address | string | Visitor IP, captured on AdsPing's server. |
client_user_agent | string | Visitor browser, captured on AdsPing's server. |
external_id | string | Anonymous visitor id pb.js sets on first visit (your externalId is sent in addition). |
About Event Match Quality (EMQ)
Meta scores each event 0–10 on how well it can match the event to a person. Every field you send adds signal. On top of what you pass, AdsPing attaches the things it can read server-side — so you never paste these:
fbp+fbc— Meta browser cookies, read by pb.js (it even buildsfbcfrom?fbclid=in the URL).client_ip_address+client_user_agent— the visitor’s IP and browser, captured on AdsPing’s server. Meta requires these for website events; they’re sent in plaintext (not hashed).external_id— an anonymous visitor id pb.js sets on first visit.
Every personal field (email, phone, name, address) is SHA-256 hashed before it leaves AdsPing — Meta only ever receives the hash. The more real fields your payload carries, the closer you get to EMQ 10/10.
Test it
- Place a test order on your site.
- Open your pixel’s Report → Recent events in AdsPing.
- A Purchase row appears within ~10 seconds with a green Success badge and its EMQ score.
✓ Purchase is live.
Every completed order is now forwarded to Meta via the Conversions API.