Skip to content
Kindle AI
Esc
↑↓navigate↵open⌘Jpreview
On this page

Kindle AI Pixel

Install the Kindle AI pixel with one script tag to attribute visits and conversions to the campaigns you run through Kindle AI.

The Kindle AI Pixel is the browser half of Kindle AI conversion tracking. It records visits to your site, attributes the ones that come from campaigns you run through Kindle AI, and lets you track conversions that happen in the browser. The Conversion API is the server half, and it handles verified conversions that only your backend can see.

This page covers the four things you need to do: install the pixel, set up your ad URLs, track conversions, and read the click ID for server-side attribution.

1. Install the pixel

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

<script
  src="/media/cdn/pixel/v1/kindle-ai-pixel.js"
  data-key="YOUR_API_KEY"
></script>

Replace YOUR_API_KEY with the pixel API key from Kindle AI. It looks like pk_79de89010be148c5a5a631ae.

Once the pixel loads, it defines a global kindle-ai() function on window for every visitor. The script URL stays the same across pixel updates (/v1/ is the URL path, not the pixel version), so you never need to change your tag.

If your code can call kindle-ai() before the pixel has loaded, add this one-liner above the pixel tag. Calls made early are queued and sent once the pixel loads:

<script>window.kindle=window.kindle||function(){(kindle-ai.q=kindle-ai.q||[]).push(arguments)};</script>

Tip: The pixel is lightweight (about 4KB gzipped), loads asynchronously, and never blocks your page from rendering.

For platform-specific install steps (Shopify theme code, Framer custom code, WordPress, GTM, and more), see Platform setup.

If you would rather serve the script from your own site and decide when it updates, see Self-hosting the pixel.

Installing via Google Tag Manager

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

  1. Go to Tags → New → Custom HTML
  2. Paste the code below
  3. Set the trigger to All Pages
  4. Click Publish
<script src="/media/cdn/pixel/v1/kindle-ai-pixel.js" data-key="YOUR_API_KEY"></script>

2. Set up your ChatGPT ad URLs

When you create ads in the ChatGPT Ads platform, add parameters to the destination URL so Kindle AI can attribute conversions back to the right campaign, ad group, and ad.

URL format

https://yoursite.com/?utm_source=chatgpt&kindle-ai_campaign=CAMPAIGN_NAME&kindle-ai_adgroup=AD_GROUP_NAME&kindle-ai_ad=AD_ID

Parameters

Parameter Required Description Example
utm_source Yes* chatgpt or openai marks the visit as coming from your campaign chatgpt
kindle-ai_campaign Recommended Your campaign name spring_launch
kindle-ai_adgroup Recommended Your ad group name us_designers
kindle-ai_ad Recommended The specific ad identifier ad_001
oppref Automatic OpenAI’s click ID, added to the URL by ChatGPT Ads. Don’t remove it. —

* Any one of utm_source=chatgpt (or openai), kindle-ai_campaign, or oppref is enough for Kindle AI to attribute the visit. The three kindle-ai_ parameters are optional, but without them your conversions all roll up under one unnamed campaign, so add them if you want per-ad reporting.

Example URLs

Minimum required:

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

Full attribution (recommended):

https://yoursite.com/?utm_source=chatgpt&kindle-ai_campaign=spring_launch&kindle-ai_adgroup=us_designers&kindle-ai_ad=ad_001

UTM fallbacks

If you already tag your URLs with standard UTM parameters, the pixel reads those automatically when the kindle-ai_ versions are missing:

Kindle AI parameter UTM fallback
kindle-ai_campaign utm_campaign
kindle-ai_adgroup utm_content
kindle-ai_ad utm_term

3. Track conversions

The pixel records these automatically, with no code from you:

  • Page views, including client-side navigation in single-page apps
  • Engagement: time on page and scroll depth
  • Clicks on buttons and links
  • Form submissions, plus a hashed email when a visitor submits a form (see Privacy and consent)

For conversions such as purchases and signups, call kindle-ai() at the moment the event happens.

Purchase

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

Signup

kindle-ai("signup");

Lead

kindle-ai("lead", { value: 50 });

Add to cart

kindle-ai("add_to_cart", { value: 29.99 });

Custom events

You can track any event name with any custom data:

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

Conversion data fields

Field Type Description
value Number Monetary value (for example, 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. Kindle AI stores all of them and makes them available in your dashboard.

Note: Browser events are best-effort by nature. Ad blockers and closed tabs mean some never arrive. Send your verified conversions (orders, signups) server-side through the Conversion API instead. It deduplicates against browser events by event ID, so you get reliable numbers without double-counting.

4. How it works

  1. A visitor clicks your ChatGPT ad and lands on your site with the tracking parameters in the URL.
  2. The pixel sees the campaign parameters and opens a session attributed to that campaign. Refreshing the page or coming back from the same ad keeps the same session; a click on a different ad starts a new one.
  3. The session lasts 30 days. It’s stored in the kindle-ai_sid cookie, with a localStorage copy as a fallback. A separate browser ID (kindle-ai_bid) lasts a year. Safari keeps cookies and storage written by any script for at most about 7 days after the visitor’s last visit, so a Safari visitor who stays away longer starts fresh.
  4. Page views and activity are recorded automatically.
  5. When you call kindle-ai(), the conversion is recorded and attributed to the original campaign.
  6. Everything shows up in your Kindle AI dashboard.

Note: The pixel records every visit, and attributes the ones that came from a campaign you run through Kindle AI.

The cookie value is JSON that contains a sid field. That sid is the Kindle AI click ID. To attribute a conversion server-side, read the click ID out of the cookie, carry it through your signup or checkout flow, and include it as kindle-ai_click_id in your Conversion API events:

function getKindle AIClickId() {
  const cookie = document.cookie
    .split("; ")
    .find((entry) => entry.startsWith("kindle-ai_sid="));
  if (!cookie) return null;
  try {
    const session = JSON.parse(
      decodeURIComponent(cookie.split("=").slice(1).join("="))
    );
    return session.sid || null;
  } catch {
    return null;
  }
}

Every visitor gets a kindle-ai_sid cookie, and Kindle AI knows on its side which sessions came from your campaigns, so you can pass the click ID along for every signup or order. If the cookie is missing, the pixel didn’t load (for example, it was blocked) or the visitor is in a consent region and hasn’t given consent yet. Send the conversion without a click ID, and never invent one.

5. Integration examples

Shopify

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

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

For the full Shopify integration, including reliable server-side order tracking, see the Shopify platform guide.

React / Next.js

function CheckoutSuccess({ order }) {
  useEffect(() => {
    if (window.kindle) {
      kindle-ai("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.kindle) {
        kindle-ai("signup");
      }
    });
</script>

Content Security Policy

If your site enforces CSP, allow /media/cdn in script-src, and both https://api.trykindle.app and https://kindle-aicore-production-d467.up.railway.app in connect-src. The pixel falls back to the second host once if the first can’t be reached.

A self-hosted pixel needs less: the script comes from your own site, and it only calls https://api.trykindle.app.

EU, EEA, UK, and Switzerland

Visitors from these regions get a small consent gate instead of the pixel. Until your cookie banner grants marketing consent, Kindle AI sets no cookies and sends nothing. These consent tools are detected automatically:

  • IAB TCF v2 (purposes 1 and 7)
  • Shopify Customer Privacy API
  • OneTrust (targeting group C0004)
  • Cookiebot (marketing)
  • Google Consent Mode (ad_storage)

If you use a different consent tool, tell Kindle AI directly:

kindle-ai("consent", "granted"); // or "denied", which also deletes Kindle AI cookies and storage

If you already load the pixel only after consent, add data-consent="granted" to the script tag.

The consent gate is applied by the Kindle AI CDN from the visitor’s location. If you host the pixel yourself, applying it is up to you.

What the pixel never collects

The pixel never collects the values people type into form fields, password, card, or SSN-type fields, or text that looks like a card or SSN number. Emails are hashed (SHA-256) in the browser before they’re sent.

Opt-outs

Attribute Effect
data-kindle-ai-no-track on any element Nothing inside it is recorded
data-kindle-ai-no-identity on a <form> No hashed email is taken from that form

To record page views and ad clicks only, with no button text, form activity or emails, see Minimal data mode.

FAQ

Does the pixel slow down my site?

No. The script is about 4KB gzipped and loads asynchronously, so 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 that window, their page views and conversions still attribute to the original campaign.

Does it track all my visitors?

The pixel records every visit, and attributes the ones that came from a campaign you run through Kindle AI.

Is window.kindle always defined?

Yes, for every visitor, once the pixel has loaded. Existing if (window.kindle) checks keep working. If your code can run before the pixel loads, use the queue one-liner from Install the pixel.

Can I use multiple API keys on one site?

No. Use one API key per site. Each key maps to a single Kindle AI account.

Was this page helpful?