[SURF-1546] feat(conversions): fire the OpenAI Ads pixel - #71
Conversation
|
| const CONVERSION_ACK_TYPE = "surface:conversion:ack"; | ||
|
|
||
| const VALID_PROVIDERS: ConversionProvider[] = ["x", "meta", "ga4", "linkedin"]; | ||
| const VALID_PROVIDERS: ConversionProvider[] = ["x", "meta", "openai", "ga4", "linkedin"]; |
There was a problem hiding this comment.
Generated bundle rejects OpenAI
When the distributed embed receives an OpenAI conversion message, the unchanged surface_tag.js allowlist rejects it before dispatch, causing the new parent-context pixel path not to run. Regenerate and commit the browser bundle after this source change.
Context Used: CLAUDE.md (source)
There was a problem hiding this comment.
Good catch, and already addressed. You reviewed 6bd10b2, which changed only the TypeScript source. The regenerated + committed bundle landed in the amended commit 04e8138 (surface_tag.js / surface_embed_v1.js now include ensureOaiq + the openai case + the openai entry in VALID_PROVIDERS). CI's "Bundle is up to date" check went from failing to passing on that commit, so deployed embeds will dispatch openai messages. Resolved.
Adds OpenAI Ads (oaiq) as a conversion provider in the parent embed tag, mirroring the in-frame firing in surface_forms. Bootstraps the oaiq SDK if absent, then measures a `customer_action` conversion with the response ID as the event_id dedupe key. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018VUdEBjARoRAXvcVtaCS2N
6bd10b2 to
04e8138
Compare
Companion to surface_forms #5094. Fires the OpenAI Ads pixel from the parent embed tag (first-party context), mirroring the in-frame firing in
surface_forms— the two paths stay in sync.Changes
providers.ts:openaiadded toConversionProvider;ensureOaiqbootstraps theoaiqSDK (bzrcdn.openai.com/sdk/oaiq.min.js) only if the global isn't already present, thenoaiq("init", {pixelId}). Fire path callsoaiq("measure", event_name, {type:"customer_action"}, {event_id: response_id})—event_idis the dedupe key.conversion-listener.ts:openaiadded toVALID_PROVIDERS.Payload shape reuses the Meta variant (
{pixel_id, event_name}), so no wire-contract change.🤖 Generated with Claude Code
https://claude.ai/code/session_018VUdEBjARoRAXvcVtaCS2N