First-party proxy · Apache

Proxy the Admaxxer pixel through Apache

One ProxyPassMatch rule in your HTTPS virtual host forwards the pixel's requests from your domain to Admaxxer, so your visitors' browsers never contact admaxxer.com. If you can only edit .htaccess, there's a variant for that too, with one server-level requirement.

Self-run proxy · Apache · Advanced

Prefer no server work at all? A managed first-party subdomain does the same job with one DNS record; the comparison below helps you choose.

Why route the pixel through your own domain

What it doesn't change

Visitors who opt out stay opted out, and tools that inspect scripts on your own pages can still interfere. A proxy also changes which network address Admaxxer sees — read what Admaxxer sees through your proxy before you switch.

Before you start

What your proxy must forward

With data-proxy-origin set, the pixel sends every request to that address instead of admaxxer.com. Forward each of these paths to the same path on https://admaxxer.com. A proxy that forwards only some of them silently loses data: custom events, purchases and identify calls each travel on a path of their own.

Path on your siteWhat uses itForward it
/pixel.jsThe tracking scriptRequired
/api/eventPageviews, time on page, checkout-return detection, email identification and the install checkRequired
/api/event/batchCustom events, goals and purchases, sent in small batchesRequired
/api/identifyadmaxxer.identify(userId, traits) for signed-in usersRequired if you identify users
/api/pixel/adblocker-probe/<website ID>window.admaxxer.probe(), only if your own code calls itOptional

Pass requests through unchanged (same method, same JSON body), addressed to admaxxer.com in both the Host header and the TLS server name. Two browser headers must survive the trip:

Cookies aren't needed: the pixel sends its visitor and session IDs inside the request body.

Already using one of these paths?

The pixel appends these paths to whatever data-proxy-origin you give it, so you can keep everything under a folder. With data-proxy-origin="https://yourdomain.com/admx" and the script at /admx/pixel.js, the pixel calls /admx/api/event, /admx/api/event/batch and so on. Forward each one to the same path on admaxxer.com without the /admx prefix.

Step 1: Enable the modules

On Debian and Ubuntu:

sudo a2enmod proxy proxy_http ssl

On other distributions these modules are usually loaded already; apachectl -M lists what's active (look for proxy_module, proxy_http_module and ssl_module).

Step 2: Add the proxy rule

Virtual host configuration

# Inside the <VirtualHost *:443> block that serves your site.
# Requires mod_proxy, mod_proxy_http and mod_ssl.
SSLProxyEngine on
ProxyPreserveHost Off
ProxyPassMatch "^/(pixel\.js|api/event|api/event/batch|api/identify)$" "https://admaxxer.com/$1"

Only have .htaccess?

If you can't edit the virtual host, the same forwarding works from .htaccess, provided mod_rewrite, mod_proxy and mod_proxy_http are available and SSLProxyEngine on is already set in the server configuration (it can't be set from .htaccess). Shared hosts often don't allow this; if the rule returns a 403 or 500, ask your host or use the managed subdomain instead.

.htaccess

# Admaxxer first-party proxy (needs mod_rewrite, mod_proxy, mod_proxy_http,
# and SSLProxyEngine on in the server configuration)
RewriteEngine On
RewriteRule ^(pixel\.js|api/event|api/event/batch|api/identify)$ https://admaxxer.com/$1 [P,L]

Put it above any existing rewrite rules, such as a CMS front-controller block. Running WordPress? Follow the WordPress guide, which covers the plugin settings too.

Step 3: Test the configuration and reload

sudo apachectl configtest
sudo systemctl reload apache2

The service is called httpd on some distributions (sudo systemctl reload httpd).

Step 4: Update your pixel snippet

Replace the Admaxxer snippet on every page with this version. Use your own Website ID (it starts with admx_; copy it from the snippet on the pixel install page) and the exact hostname your pages load from, such as www.yourdomain.com if that is your site's address.

<script async
  src="https://yourdomain.com/pixel.js"
  data-website-id="admx_your_website_id"
  data-proxy-origin="https://yourdomain.com">
</script>

Replace, don't add

Keep exactly one Admaxxer snippet per page. If two load, only the first one runs, so a leftover standard snippet can keep sending events to admaxxer.com.

Using Pro tracking or another script variant

/pixel.js always serves the standard script. To use another variant, such as script.plus.js for Pro tracking, forward /js/script.plus.js instead of /pixel.js and point src at https://yourdomain.com/js/script.plus.js. Leave data-proxy-origin as it is: every variant reads it.

Step 5: Check that it works

Run these from any terminal, replacing yourdomain.com with your site's hostname:

# 1. The script loads through your domain: expect HTTP 200 and a JavaScript content type
curl -sI https://yourdomain.com/pixel.js

# 2. Each endpoint reaches Admaxxer. An empty body is rejected on purpose,
#    so nothing is recorded; the error reply proves the route works.
curl -s -X POST https://yourdomain.com/api/event -H 'Content-Type: application/json' -d '{}'
#    expect: {"error":"validation_failed", ...}
curl -s -X POST https://yourdomain.com/api/event/batch -H 'Content-Type: application/json' -d '{}'
#    expect: {"error":"empty_batch"}
curl -s -X POST https://yourdomain.com/api/identify -H 'Content-Type: application/json' -d '{}'
#    expect: {"error":"validation_failed", ...}

Only Admaxxer answers with those error messages. If you get your own site's 404 page or HTML instead, that path isn't being forwarded.

Then load your site with the browser's developer tools open on the Network tab. The script and the api/event requests should go to your own domain (none to admaxxer.com), and accepted events are answered with 202. Finally, open the pixel install page: the Verify install card turns green once events arrive.

What Admaxxer sees through your proxy

Visitors and sessions are counted from the IDs the pixel sends, so those numbers don't change. What changes is the network address: Admaxxer uses the address of whatever connects to it, and through a self-run proxy that is your proxy, not your visitor. Forwarding headers such as X-Forwarded-For are not used for this.

Troubleshooting

Self-run proxy or managed subdomain?

Admaxxer can also serve the pixel from a subdomain of yours with no proxy to run: in Integrations, open First-party tracking domain, add a subdomain such as t.yourdomain.com and create the one DNS record it shows. Both options load the pixel and send events from your own domain.

Managed first-party subdomainSelf-run proxy (this guide)
HostnameA subdomain, such as t.yourdomain.comThe hostname your site already uses
What you set upOne CNAME recordForwarding rules on your server, CDN or framework
Who keeps it runningAdmaxxerYou
SnippetShown in Admaxxer once DNS is verifiedWritten by you, from this guide

Choose a self-run proxy when you can't add DNS records, don't want a separate tracking subdomain, or need every request to pass through infrastructure you control. Otherwise the managed subdomain is less to maintain; see the first-party tracking domain guide.

Undo the setup

Put the standard snippet back first (copy it from the pixel install page), then remove the ProxyPassMatch line (or the .htaccess rule), run sudo apachectl configtest and reload Apache. In that order, no page ever points at a path that has stopped working.

Same setup on another platform: Cloudflare Workers · NGINX · Vercel · Next.js · Netlify · Nuxt · WordPress

Frequently asked questions

Q: Do I need this if I set up a first-party tracking domain in Admaxxer?

No, use one or the other. Both make the pixel load and report from your own domain. The managed subdomain is set up in Admaxxer with one DNS record; a self-run proxy runs on your own server, CDN or framework.

Q: Will this stop ad blockers from blocking Admaxxer?

It removes admaxxer.com from every request, which is what hostname-based block lists match on. Blockers that inspect scripts or paths on your own site can still interfere, and visitors who opt out stay opted out.

Q: Do I need ProxyPassReverse?

No. ProxyPassReverse rewrites redirect headers, and these requests don't redirect.

Q: Why do all my visitors show up in one country?

Admaxxer can't see your visitors' network addresses through your proxy. It reads the country from a CF-IPCountry, X-Vercel-IP-Country or X-Real-Country header when one is passed along, and otherwise uses your proxy's location. Pass one of those headers with the visitor's two-letter country code.

Q: Can I download pixel.js and host the file myself?

You can, but you'd stop receiving pixel updates. Forwarding the script keeps it current automatically, and the event paths have to be forwarded either way.