Skip to main content

What Gravity does for you

Gravity places your brand inside real conversations on AI platforms — chat apps, coding assistants, AI search. When a conversation is relevant to your product, Gravity generates an ad tuned to that specific conversation. You don’t write ad copy. There are two things you need to set up:
  1. Install the Gravity pixel on your website so we can track who clicked your ad
  2. Send us your conversions so we can tell you which ads are actually driving revenue
That’s the whole integration. Let’s walk through it.

Step 1 — Sign up and create a campaign

  1. Go to app.trygravity.ai/advertiser/signup
  2. Enter your email and company name
  3. Add a credit card (you can set a billing plan later)
Then create your first campaign: Dashboard → Campaigns → New.
FieldWhat to enter
NameAn internal label (users won’t see this)
URLYour landing page — Gravity reads it to understand your product and generate relevant ads
Daily budgetThe most you want to spend per day
Hit save — your campaign is live.

Step 2 — Install the pixel on your website

This is required. Without the pixel, Gravity can’t track conversions or optimize your campaigns.
Add this snippet to the <head> of your website. It needs to be on every page and every subdomain where a visitor might land or convert.
<script>
  !function(w,d,t,u,n,a,m){w['GravityPixelObject']=n;w[n]=w[n]||function(){
  (w[n].q=w[n].q||[]).push(arguments)},w[n].l=1*new Date();a=d.createElement(t),
  m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
  }(window,document,'script','https://code.trygravity.ai/gr-pix.js','gravity');
  gravity('init', 'YOUR_ADVERTISER_ID');
</script>
Replace YOUR_ADVERTISER_ID with your ID from Settings → Organization in the dashboard.
Put the pixel in your site’s root layout or header template so it loads on every page automatically. Don’t add it to individual pages one by one — that’s error-prone and you’ll miss pages.
Using Shopify? Skip this — the Shopify integration installs the pixel automatically. See Step 3.

Verify the pixel is working

  1. Open your website in a browser
  2. Open DevTools (right-click → Inspect → Network tab)
  3. Look for a request to api.trygravity.ai/track/gr-events
  4. A 200 response means it’s working

Step 3 — Set up conversion tracking

The pixel tracks page views. To track actual conversions (purchases, signups, demo requests), you need to send them from your server. This is called the Conversions API (CAPI). Pick the option that matches your setup:

Shopify

One-click connect. Pixel + conversions are automatic — no code needed.

Conversions API

Send conversions from your backend. Works with any platform.

App installs

Track iOS / Android installs via your backend or MMP postback.

Cal.com

Booking webhook for demo / consulting flows.

Quick CAPI example

If you’re not on Shopify, here’s the gist. Full guide: Server-side conversions. 1. On your checkout/thank-you page, read the pixel’s attribution data:
var capiData = window.gravityPixel.getCAPIData();

// Send it to your backend with the order
fetch('/api/complete-order', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    order_id: 'order-123',
    total: 99.99,
    email: 'customer@example.com',
    gravity: capiData
  })
});
2. On your backend, forward it to Gravity:
gravity_data = request.json.get("gravity", {})

requests.post(
    "https://api.trygravity.ai/gateway/events",
    params={"api_key": "YOUR_API_KEY"},
    json={
        "data": [{
            "event_name": "Purchase",
            "event_time": int(time.time()),
            "event_id": f"order-{order_id}",
            "action_source": "website",
            "event_source_url": gravity_data.get("event_source_url", ""),
            "user_data": {
                **gravity_data.get("user_data", {}),
                "em": [customer_email],
            },
            "custom_data": {
                "value": order_total,
                "currency": "USD",
                "order_id": order_id,
            },
        }],
    },
)
That’s it. Gravity handles attribution, deduplication, and reporting from here.

Step 4 — Watch it run

Dashboard → Campaigns → your campaign. You’ll see:
  • Impressions, clicks, and spend
  • Conversion count and ROAS (once conversions are flowing)
  • Top-performing publishers and conversation topics

Optional — Improve attribution accuracy

For even better tracking (especially on Safari and browsers that block third-party cookies), you can route pixel requests through your own domain. It’s a simple forwarding rule — no custom code. See the first-party proxy setup in the Pixel guide.

Next

Conversions API

Full CAPI setup guide with Python, Node.js, and cURL examples.

Campaigns

Targeting, bidding, and creative guidelines.
Questions? support@trygravity.ai