Why you need this
Without the pixel, Gravity can measure impressions and clicks — but not what happens after the user lands on your site. Install the pixel and we can attribute purchases, signups, and demo requests back to the specific ad that drove them. This unlocks:- Per-campaign conversion rate and ROAS in your dashboard
- Conversion reporting tied back to specific campaigns and ads
- Retargeting audience segmentation (upcoming feature)
Install the pixel
Add this snippet to the<head> of your website. It must be on every page and every subdomain where visitors might land or convert.
YOUR_ADVERTISER_ID lives in your dashboard under Settings → Organization. It’s a UUID.
Verify it’s firing
- Load any page on your site with the pixel installed.
- Open your browser DevTools → Network tab and look for a request to
api.trygravity.ai/track/gr-events. - A
200response means the pixel is firing correctly. Events typically appear in your dashboard within ~10 minutes.
Tracking conversions
The pixel captures page views and attribution context. Conversions (purchases, signups, etc.) are tracked separately — see the CAPI guide for setup.Optional — Improve attribution with a first-party proxy
By default, the Gravity pixel sends tracking requests toapi.trygravity.ai. Some browsers (especially Safari) block or limit these third-party requests, which can reduce attribution accuracy.
The fix is simple: add a forwarding rule to your web server so pixel requests go through your own domain instead. No custom code — just a one-line config change for your platform.
Add a forwarding rule
Pick your platform:Vercel / Next.js
Vercel / Next.js
Add to your Deploy as usual — Vercel handles everything at the edge.
next.config.js (or next.config.ts):Cloudflare Worker
Cloudflare Worker
Create a Worker that intercepts Attach the Worker to your domain’s route via the Cloudflare dashboard.
/gr/ requests:Nginx
Nginx
Add to your server block:
Caddy
Caddy
Apache
Apache
Enable
mod_proxy and mod_proxy_http, then add:Express / Node.js
Express / Node.js
Using
http-proxy-middleware:Configure the pixel
Add the proxy endpoint to your pixel install snippet, before the main pixel script tag:/gr/ with whatever path you chose in your forwarding rule.
Verify it’s working
- Load a page on your site with the pixel installed
- Open DevTools → Network tab
- Look for requests going to your domain at
/gr/init— not toapi.trygravity.ai
Respect consent
Don’t fire the pixel or send conversions before the user accepts your cookie/consent banner (where one applies in your jurisdiction). Standard integration patterns — conditional script load behind a consent manager — work as expected.Next
Conversions API
Full CAPI setup guide with examples.
App installs
Track iOS / Android installs as conversions.