ClickFunnels : Pixel et CAPI OpenAI Ads pour ClickFunnels 2.0 : Configuration complète
Guide pas à pas pour configurer le pixel et l'API Conversions sur ClickFunnels 2.0 pour les leads, checkouts et ventes incitatives.
ClickFunnels campaigns rely on seamless multi-step order flows, but tracking conversions across upsells and order bumps often introduces data discrepancies.
When a customer accepts an upsell but closes their browser before reaching the confirmation screen, client-side scripts miss that revenue entirely. Conversely, if purchasers reload thank-you pages, browser pixels can record duplicate conversions.
Building a dependable telemetry setup requires pairing browser-based engagement tracking with backend webhook processing.
Placing the measurement pixel in global funnel settings captures visits and initial checkouts. Concurrently, configuring ClickFunnels webhook endpoints to transmit verified purchase notifications to OpenAI's Conversions API ensures all transactions register accurately regardless of browser behavior.
Here is how to set up client pixels and server webhook relays for ClickFunnels 2.0.
Global base pixel setup in ClickFunnels
Deploy the measurement pixel across every funnel step by adding it to site settings:
- In ClickFunnels 2.0, open Sites, then Overview.
- Select the gear icon to open Site Settings.
- Locate Head Tracking Code.
- Paste the base pixel script:
<script>
!function(w,d,e,u,t,s){if(w.openaiAds)return;t=w.openaiAds=function(){
t.callMethod?t.callMethod.apply(t,arguments):t.queue.push(arguments)};
if(!w._openaiAds)w._openaiAds=t;t.push=t;t.loaded=!0;t.version='1.0';
t.queue=[];s=d.createElement(e);s.async=!0;s.src=u;
var f=d.getElementsByTagName(e)[0];f.parentNode.insertBefore(s,f);
}(window,document,'script','https://bzrcdn.openai.com/pixel.js');
openaiAds('init', 'YOUR_PIXEL_ID');
openaiAds('track', 'PageView');
</script>
This ensures page view and click attribution parameters are captured on initial landing.
Client purchase tracking on confirmation steps
On your order confirmation or thank-you funnel step, add a script to capture the front-end purchase event:
<script>
(function() {
var orderId = '{{ order.id }}' || new URLSearchParams(window.location.search).get('order_id');
if (!orderId) return;
var dedupKey = 'cf_' + orderId;
if (window.openaiAds) {
window.openaiAds('track', 'Purchase', {
currency: 'USD',
value: Math.round(parseFloat('{{ order.total_amount }}' || 0) * 100),
order_id: orderId
}, {
event_id: dedupKey
});
}
})();
</script>
Backend webhook relay implementation
To record purchases that occur through background rebills, subscription renewals, or dropped client sessions, deploy an endpoint subscribed to ClickFunnels order.created webhooks:
const express = require('express');
const crypto = require('crypto');
const axios = require('axios');
const app = express();
app.use(express.json());
function sha256(val) {
if (!val) return null;
return crypto.createHash('sha256').update(val.trim().toLowerCase()).digest('hex');
}
app.post('/webhooks/clickfunnels', async (req, res) => {
const event = req.body;
if (!event || event.event_type !== 'order.created') {
return res.status(200).send('Ignored event');
}
const order = event.data;
const orderId = String(order.id);
const dedupKey = 'cf_' + orderId;
const valueCents = Math.round(parseFloat(order.total_amount || 0) * 100);
const capiPayload = {
data: [
{
event_name: 'Purchase',
event_time: Math.floor(new Date(order.created_at).getTime() / 1000),
event_id: dedupKey,
action_source: 'system_generated',
user_data: {
em: sha256(order.customer?.email),
ph: sha256(order.customer?.phone)
},
custom_data: {
currency: order.currency || 'USD',
value: valueCents,
order_id: orderId
}
}
]
};
try {
await axios.post('https://bzr.openai.com/v1/events', capiPayload, {
headers: {
'Authorization': 'Bearer YOUR_OPENAI_ADS_ACCESS_TOKEN',
'Content-Type': 'application/json'
}
});
res.status(200).send('Webhook relayed');
} catch (err) {
console.error('CAPI transmission error', err.response?.data || err.message);
res.status(500).send('Relay failure');
}
});
app.listen(3000, () => console.log('ClickFunnels CAPI relay active'));
Configuring webhooks in ClickFunnels 2.0
- In ClickFunnels 2.0, open Settings in the left sidebar.
- Select Webhooks and click Add Webhook.
- Enter your relay URL, such as
https://yourdomain.com/webhooks/clickfunnels. - Choose
order.createdunder Event Types. - Save the webhook configuration and trigger a test transaction.
Verification checklist
Complete a test purchase through the full funnel, including an upsell or bump offer.
Confirm in your network tab that the client Purchase event dispatches with event_id equal to cf_{orderId}.
Check your server webhook logs to confirm the backend relay receives order.created and sends the matching payload to OpenAI.
Verify in OpenAI Ads Event Manager that the browser and server purchases merge into one attributed conversion.
Frequently asked questions
Where is the global tracking code setting in ClickFunnels 2.0?
Navigate to Sites, select Overview, click Site Settings, and insert the script into the Head Tracking Code field.
How does the server relay capture upsell transactions?
ClickFunnels sends an order.created webhook notification whenever a transaction clears, including secondary upsell orders, even if the user never completes browser navigation.
How are duplicate purchases prevented when users refresh thank-you pages?
By formatting the event_id deterministically as cf_{order_id}, OpenAI's ingestion pipeline recognizes identical identifiers within a 48-hour window and discards redundant signals.
What currency format should be passed to OpenAI CAPI?
Amounts should be expressed as integer cents. Multiply dollar totals by 100 and round to eliminate fractional floating-point values.
Besoin d’installer le suivi ChatGPT Ads ?
Configuré, testé, documenté.