Skip to content
English - United States
  • There are no suggestions because the search field is empty.

How to send Leadster conversions to ChatGPT Ads

Overview

Ads in ChatGPT are available on the Free and Go plans. In this tutorial, you'll learn how to send a conversion to ChatGPT Ads when a specific Leadster event happens on your website.

Step by step

Follow the steps below:


  1. Prerequisite:

    The ChatGPT Ads OpenAI Measurement Pixel must be installed and set up on the website. After installation, the oaiq function must be available on the page.  


  2. Identify the event in the dataLayer:

    Identify the event in the dataLayer. Leadster can make conversion information available in the dataLayer. The example below considers a qualified lead:

dataLayer.push({ 
event: "leadster_conversion", 
conversion_type: "qualified_lead" 
}); 

3. Send the conversion to ChatGPT Ads

The JavaScript below watches for new pushes to the dataLayer. When it finds the event you want, it calls the OpenAI Measurement Pixel.

window.dataLayer = window.dataLayer || [];
const originalPush = window.dataLayer.push.bind(window.dataLayer);
window.dataLayer.push = function () {
const args = Array.from(arguments);
args.forEach(function (data) {
if (
data &&
data.event === "leadster_conversion" &&
data.conversion_type === "qualified_lead"
) {
if (typeof window.oaiq === "function") {
window.oaiq("measure", "lead_created", {
type: "customer_action"
});
}
}
});
return originalPush.apply(window.dataLayer, args);
};
  1. What happens in practice:

Conversion in Leadster ➡️ Event in the dataLayer ➡️ JavaScript detects it ➡️ oaiq sends it to ChatGPT Ads


  1. Event sent:

Following the example above, when conversion_type is qualified_lead, this will run:

oaiq("measure", "lead_created", {
type: "customer_action"
});

When you apply this code to your website, make sure that:

✅ The OpenAI Measurement Pixel is installed on the website.

✅ The oaiq function is available on the page.

✅ The dataLayer event and properties are confirmed to be correct.

✅ The rule is set to fire only on the conversion you want.

✅ A test was run in a controlled environment before publishing.

Points to watch out for

Important: The code in this article is an implementation example. Event names must be adapted to the dataLayer available on the customer's website.

If you have any questions, contact our team through support.

Best regards 👋