OpenAI Ads Web Device Mode Integration Private Beta
3 minute read
The OpenAI Ads destination is currently in Private Beta, where we work with early users and customers to test new features and get feedback before making them generally available.
Reach out to Customer Success if you’re interested in enabling this destination for your workspace.
After you have successfully instrumented OpenAI Ads as a destination in RudderStack, follow this guide to correctly send your events to OpenAI Ads in web device mode.
Find the open source JavaScript SDK code for this destination in the GitHub repository.
OpenAI Ads supports device mode only for web sources. Mobile device mode is not supported. Mobile and other non-web source types use cloud mode only.
Add web device mode integration
The RudderStack JavaScript SDK loads the OpenAI Ads Measurement Pixel from https://bzrcdn.openai.com/sdk/oaiq.min.js and initializes it with your Pixel ID.
If you use a Content Security Policy (CSP) header on your website, allowlist the bzrcdn.openai.com domain for script loading.
Identify
Use the identify call to update the user data stored by the OpenAI Ads Measurement Pixel.
A sample identify call is shown below:
rudderanalytics.identify("user-123", {
email: "alex@example.com",
phone: "+15551234567",
firstName: "Alex",
lastName: "Keener",
city: "San Francisco",
state: "CA",
country: "US",
postalCode: "94105",
});RudderStack maps identify traits to the OpenAI Ads Measurement Pixel user object as follows:
| RudderStack property | OpenAI Ads user field | Notes |
|---|---|---|
traits.emailcontext.traits.email | email_sha256 | Normalized and hashed by RudderStack. |
traits.phonecontext.traits.phone | phone_number_sha256 | Normalized and hashed by RudderStack. |
userIdanonymousId | external_id_sha256 | Normalized and hashed by RudderStack. |
traits.firstNametraits.first_namecontext.traits.firstNamecontext.traits.first_name | first_name_sha256 | Normalized and hashed by RudderStack. |
traits.lastNametraits.last_namecontext.traits.lastNamecontext.traits.last_name | last_name_sha256 | Normalized and hashed by RudderStack. |
traits.citycontext.traits.city | city | Sent as a plain value. |
traits.statecontext.traits.state | region | Sent as a plain value. |
traits.postalCodecontext.traits.postalCode | postal_code | Sent as a plain value. |
traits.countrycontext.traits.country | country | Sent as a plain value. |
RudderStack rejects apparent pre-hashed values passed into non-hashed fields.
Track
Use the track call to send conversion events to OpenAI Ads.
A sample track call is shown below:
rudderanalytics.track("Order Completed", {
orderId: "order-123",
revenue: 49.99,
currency: "USD",
products: [
{
product_id: "sku-123",
name: "T-shirt",
category: "Apparel",
quantity: 1,
price: 49.99,
},
],
});RudderStack uses your event mapping settings to resolve the OpenAI Ads event type for each track event. If no mapping matches the RudderStack event name, RudderStack does not send the event to the Measurement Pixel.
The Measurement Pixel does not support the app_installed and app_opened events. These events are supported in cloud mode, but not in web device mode.
Track event data
RudderStack maps the following event data fields in web device mode:
| RudderStack property | OpenAI Ads field | Notes |
|---|---|---|
messageId or configured deduplication key path | event_id | Sent in the Measurement Pixel event options. The configured path must resolve to a scalar value. |
properties.optOutproperties.opt_out | opt_out | Optional boolean value sent in the Measurement Pixel event options. |
properties.amountproperties.valueproperties.revenue | amount | Converted to the currency’s minor units when currency is available. |
properties.currencyDefault currency setting | currency | Sent when amount is present. |
properties.plan_idproperties.planId | plan_id | Sent for plan_enrollment and custom event data shapes. |
properties.contentsproperties.products | contents | Sent for contents, plan_enrollment, and custom event data shapes. Not sent for customer_action events. |
For each item in properties.contents or properties.products, RudderStack maps the following fields:
| RudderStack property | OpenAI Ads field |
|---|---|
idcontent_idcontentIditem_iditemIdproduct_idproductIdsku | id |
nametitleproduct_nameproductName | name |
content_typecontentTypetypecategoryproduct_category | content_type |
quantitycount | quantity |
amountvalueprice | amount |
currencycurrency_codecurrencyCode | currency |
Page
Use the page call to send web page view events to OpenAI Ads.
A sample page call is shown below:
rudderanalytics.page();RudderStack resolves page events using your event mapping settings. Unmapped page events default to the OpenAI Ads page_viewed event.
Screen
The OpenAI Ads web device mode integration does not support the screen call. Send screen events in cloud mode instead.