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:
<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).
Installing via Google Tag Manager
If you use GTM, you can add the pixel there instead of editing your site code directly:
- 1Go to Tags → New → Custom HTML
- 2Paste the following code:
- 3Set the trigger to All Pages
- 4Click Publish
<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
https://yoursite.com/?utm_source=chatgpt&lapis_campaign=CAMPAIGN_NAME&lapis_adgroup=AD_GROUP_NAME&lapis_ad=AD_IDParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| utm_source | Required | Must be chatgpt or openai — this activates the pixel | chatgpt |
| lapis_campaign | Recommended | Your campaign name | spring_launch |
| lapis_adgroup | Recommended | Your ad group name | us_designers |
| lapis_ad | Recommended | The specific ad identifier | ad_001 |
Example URLs
Basic (minimum required):
https://yoursite.com/?utm_source=chatgptFull attribution (recommended):
https://yoursite.com/?utm_source=chatgpt&lapis_campaign=spring_launch&lapis_adgroup=us_designers&lapis_ad=ad_001UTM fallbacks
If you already use standard UTM parameters, the pixel will fall back to those automatically:
| Lapis Parameter | UTM Fallback |
|---|---|
| lapis_campaign | utm_campaign |
| lapis_adgroup | utm_content |
| lapis_ad | utm_term |
3Track conversions
Page views are tracked automatically. For conversions (purchases, signups, etc.), call the lapis() function when the event happens.
Purchase
lapis("purchase", {
value: 149.99,
currency: "USD",
order_id: "ORD-123"
});Signup
lapis("signup");Lead
lapis("lead", { value: 50 });Add to Cart
lapis("add_to_cart", { value: 29.99 });Custom events
You can track any event with any custom data:
lapis("subscribe", { plan: "pro", interval: "yearly", value: 199 });
lapis("form_submit", { form_name: "contact", source: "footer" });
lapis("download", { file: "whitepaper.pdf" });Conversion data fields
| Field | Type | Description |
|---|---|---|
| value | Number | Monetary value (e.g. 149.99) |
| currency | String | ISO currency code, defaults to "USD" |
| order_id | String | Unique order identifier, used for deduplication |
You can include any additional fields — they are all stored and available in your dashboard.
4How it works
- 1A user clicks your ChatGPT ad and lands on your site with the tracking parameters
- 2The pixel detects the
utm_source=chatgptparameter and creates a session - 3A cookie (
lapis_sid) is set for 30 days to track the visitor across pages - 4Every page view is automatically recorded
- 5When you call
lapis(), the conversion is recorded and attributed to the original campaign - 6All data appears in your Lapis dashboard
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:
<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
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
<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'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.