Lapis Pixel

Track conversions from your ChatGPT Ads campaigns with a lightweight tracking pixel. Install in minutes, attribute every click.

1Install the Pixel

Add this script tag to every page of your website, just before the closing </body> tag:

html
<script
  src="https://cdn.trylapis.com/pixel/v1/lapis-pixel.js"
  data-key="YOUR_API_KEY"
></script>

Replace YOUR_API_KEY with the pixel API key provided by Lapis (e.g. pk_79de89010be148c5a5a631ae).

Once installed, the pixel exposes a global lapis() function on window for any visitor that arrived from a ChatGPT ad. Use this function to track conversions like purchases, signups, and custom events. For all other traffic the function is not defined, so always guard calls with if (window.lapis).

The pixel is lightweight (~2KB), loads asynchronously, and will never block your page rendering.

Installing via Google Tag Manager

If you use GTM, you can add the pixel there instead of editing your site code directly:

  1. 1Go to Tags → New → Custom HTML
  2. 2Paste the following code:
  3. 3Set the trigger to All Pages
  4. 4Click Publish
html
<script src="https://cdn.trylapis.com/pixel/v1/lapis-pixel.js" data-key="YOUR_API_KEY"></script>

2Set up your ChatGPT Ad URLs

When creating ads in the ChatGPT Ads platform, your destination URL needs specific parameters so Lapis can attribute conversions back to the right campaign, ad group, and ad.

URL format

url
https://yoursite.com/?utm_source=chatgpt&lapis_campaign=CAMPAIGN_NAME&lapis_adgroup=AD_GROUP_NAME&lapis_ad=AD_ID

Parameters

ParameterRequiredDescriptionExample
utm_sourceRequiredMust be chatgpt or openai — this activates the pixelchatgpt
lapis_campaignRecommendedYour campaign namespring_launch
lapis_adgroupRecommendedYour ad group nameus_designers
lapis_adRecommendedThe specific ad identifierad_001

Example URLs

Basic (minimum required):

url
https://yoursite.com/?utm_source=chatgpt

Full attribution (recommended):

url
https://yoursite.com/?utm_source=chatgpt&lapis_campaign=spring_launch&lapis_adgroup=us_designers&lapis_ad=ad_001

UTM fallbacks

If you already use standard UTM parameters, the pixel will fall back to those automatically:

Lapis ParameterUTM Fallback
lapis_campaignutm_campaign
lapis_adgrouputm_content
lapis_adutm_term

3Track conversions

Page views are tracked automatically. For conversions (purchases, signups, etc.), call the lapis() function when the event happens.

Purchase

javascript
lapis("purchase", {
  value: 149.99,
  currency: "USD",
  order_id: "ORD-123"
});

Signup

javascript
lapis("signup");

Lead

javascript
lapis("lead", { value: 50 });

Add to Cart

javascript
lapis("add_to_cart", { value: 29.99 });

Custom events

You can track any event with any custom data:

javascript
lapis("subscribe", { plan: "pro", interval: "yearly", value: 199 });
lapis("form_submit", { form_name: "contact", source: "footer" });
lapis("download", { file: "whitepaper.pdf" });

Conversion data fields

FieldTypeDescription
valueNumberMonetary value (e.g. 149.99)
currencyStringISO currency code, defaults to "USD"
order_idStringUnique order identifier, used for deduplication

You can include any additional fields — they are all stored and available in your dashboard.

4How it works

  1. 1A user clicks your ChatGPT ad and lands on your site with the tracking parameters
  2. 2The pixel detects the utm_source=chatgpt parameter and creates a session
  3. 3A cookie (lapis_sid) is set for 30 days to track the visitor across pages
  4. 4Every page view is automatically recorded
  5. 5When you call lapis(), the conversion is recorded and attributed to the original campaign
  6. 6All data appears in your Lapis dashboard
The pixel only activates for visitors coming from ChatGPT ads. All other traffic is ignored — the script does nothing and lapis() is not defined.

5Integration examples

Shopify

Add the pixel script in Settings > Custom Code > Before </body> tag. Then track purchases on the order confirmation page:

html
<script>
  if (window.lapis && Shopify.checkout) {
    lapis("purchase", {
      value: Shopify.checkout.total_price / 100,
      currency: Shopify.checkout.currency,
      order_id: Shopify.checkout.order_id
    });
  }
</script>

React / Next.js

jsx
function CheckoutSuccess({ order }) {
  useEffect(() => {
    if (window.lapis) {
      lapis("purchase", {
        value: order.total,
        currency: order.currency,
        order_id: order.id
      });
    }
  }, []);

  return <div>Thank you for your purchase!</div>;
}

Signup form

html
<form id="signup-form">
  <input type="email" name="email" />
  <button type="submit">Sign Up</button>
</form>

<script>
  document.getElementById("signup-form")
    .addEventListener("submit", function () {
      if (window.lapis) {
        lapis("signup");
      }
    });
</script>

6FAQ

Does the pixel slow down my site?

No. The script is ~2KB and loads asynchronously. It never blocks page rendering.

What if a visitor comes back days later?

The session cookie lasts 30 days. If a visitor from a ChatGPT ad returns within 30 days, their page views and conversions are still attributed to the original campaign.

Does it track all my visitors?

No. The pixel only tracks visitors who arrived from a ChatGPT ad (via the utm_source parameter). All other traffic is completely ignored.

What if lapis() is called but the visitor didn&apos;t come from ChatGPT?

Nothing happens. The lapis() function is only defined for ChatGPT ad visitors. Always check if (window.lapis) before calling it to avoid errors.

Can I use multiple API keys on one site?

No. Use one API key per site. Each key maps to one Lapis account.