← Retour aux articles

Bubble.io : Pixel et CAPI OpenAI Ads pour applications Bubble.io : Configuration complète

Guide technique pour configurer le pixel et l'API Conversions sur Bubble.io via l'API Connector et les workflows backend.

2026-04-06 • CMS & Website Builders

Bubble enables teams to ship complex software quickly, but tracking user conversions requires a different approach than on traditional multi-page sites.

Because Bubble runs as a single-page application handling dynamic page states, traditional tracking tags that rely on browser page loads can miss critical funnel milestones.

Fortunately, Bubble's backend workflows provide native server execution. You can use Bubble's API Connector to dispatch Conversions API payloads directly to OpenAI's ingestion endpoint whenever a user completes an action in your database. Combining backend triggers with client-side pixel tags creates a reliable dual-tracking system.

Here is how to implement client-side pixel tracking, configure backend CAPI workflows, and handle deduplication inside Bubble.

Adding the base measurement pixel to Bubble

Add the client-side loader script to your application header:

  1. Open your Bubble editor and navigate to Settings, then select SEO / Metatags.
  2. Locate the Script/meta tags in the header section.
  3. Paste the following tracking snippet:

<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>

Replace YOUR_PIXEL_ID with your actual identifier from Ads Manager.

Configuring the Bubble API Connector for CAPI

Install Bubble's official API Connector plugin to manage authenticated outbound HTTP requests:

  1. In Bubble, open Plugins and install API Connector.
  2. Click Add another API and set the name to OpenAI Ads CAPI.
  3. Set Authentication to Private key in header, Key name to Authorization, and Key value to Bearer YOUR_OPENAI_ADS_ACCESS_TOKEN.
  4. Click Add another call and name it Send Event.
  5. Set Use as to Action and Data type to JSON.
  6. Set the method to POST and the URL to https://bzr.openai.com/v1/events.
  7. Add a header for Content-Type: application/json.
  8. Input the following JSON body structure:
{
  "data": [
    {
      "event_name": "<event_name>",
      "event_time": <event_time>,
      "event_id": "<event_id>",
      "user_data": {
        "em": "<hashed_email>",
        "ph": "<hashed_phone>"
      },
      "custom_data": {
        "value": <value_cents>,
        "currency": "<currency>"
      },
      "action_source": "system_generated"
    }
  ]
}

Uncheck the Private checkbox next to each dynamic placeholder so workflows can pass live variable values at runtime.

Backend workflow implementation

Use Bubble backend workflows to isolate telemetry dispatches from client browser conditions:

  1. Navigate to Backend workflows in your editor. If not visible, enable backend workflows under Settings, then API.
  2. Add a new API Workflow named dispatch_openai_event.
  3. Add parameters for event_name (text), event_id (text), hashed_email (text), value_cents (number), and currency (text).
  4. Add an action choosing OpenAI Ads CAPI - Send Event, mapping each parameter directly to your workflow arguments.
  5. Set event_time using Current date/time:extract UNIX timestamp.

Client workflow and event pairing

When a visitor signs up or initiates a checkout, coordinate both execution layers:

First, construct an event key by combining a prefix, user ID, and timestamp, such as bubble_ & Current User's unique id & _ & Current date/time:extract UNIX timestamp.

Second, use a Toolbox Run JavaScript action to execute the client tag with the shared ID:

if (window.openaiAds) {
  window.openaiAds('track', 'CompleteRegistration', {}, {
    event_id: 'VALUE_FROM_PREVIOUS_STEP'
  });
}

Schedule the backend workflow: Immediately schedule dispatch_openai_event passing the identical event ID and the hashed customer email.

Verification checklist

Run Initialize call inside the API Connector with sample values to verify that OpenAI returns HTTP 200 OK.

Open Server logs under the Logs tab in Bubble to verify that the scheduled API workflow executes without exceptions.

Check the conversions event stream in OpenAI Ads Manager to ensure that browser and server events fuse into a single deduplicated action.

Frequently asked questions

Where do I place the pixel script in Bubble?

Add the script under Settings, then SEO / Metatags, inside the header scripts section. This loads the tracker on all public application pages.

How do I trigger server-side OpenAI events in Bubble?

Configure an API call in the API Connector pointing to https://bzr.openai.com/v1/events, then call that action from a Backend Workflow triggered by database changes or payment webhooks.

How should customer emails be hashed in Bubble?

Normalize emails with lowercase and trimming, then pass them through a SHA-256 plugin or custom script before supplying the string to your CAPI payload.

How do I ensure Bubble events are deduplicated?

Create a shared string identifier in your workflow and pass it as event_id to both the browser pixel action and the scheduled backend API workflow.

Besoin d’installer le suivi ChatGPT Ads ?

Configuré, testé, documenté.