Skip to content

Use a first party endpoint ​

Send the events through a path of your website, for example /_lg. The visitor ID then stays for 13 months in Safari, and fewer ad blockers stop the events.

Safari keeps a cookie from a script for 7 days only. It also limits a cookie from a subdomain that points to a different company to 7 days. The same limit applies to a cookie from a server with a different IP range. Thus the path must be on the same server or CDN as your website. A separate subdomain does not help.

Procedure ​

  1. Send all requests to /_lg/ on your website to https://in.quickpipe.ai/. Keep the method, the query, the headers and the body. Remove /_lg from the path. Use the recipe for your platform in the next section.

  2. Set the endpoint on the script tag:

    html
    <script async src="https://cdn.jsdelivr.net/npm/@quickpipeaiab/[email protected]/dist/lg.js"
            integrity="sha384-…" crossorigin="anonymous"
            data-key="lg-pub-live-…"
            data-endpoint="/_lg"></script>
  3. With npm, set the option endpoint:

    ts
    createClient({ key: 'lg-pub-live-…', endpoint: '/_lg' });

Recipes ​

Cloudflare Worker ​

Add a route example.com/_lg/* to this Worker:

ts
export default {
  async fetch(request: Request): Promise<Response> {
    const url = new URL(request.url);
    url.hostname = 'in.quickpipe.ai';
    url.pathname = url.pathname.replace(/^\/_lg/, '');
    const proxied = new Request(url, request);
    proxied.headers.set('X-Forwarded-For', request.headers.get('CF-Connecting-IP') ?? '');
    return fetch(proxied);
  },
};

Next.js ​

Add a rewrite to next.config.ts:

ts
const config = {
  async rewrites() {
    return [{ source: '/_lg/:path*', destination: 'https://in.quickpipe.ai/:path*' }];
  },
};

export default config;

Vercel ​

Add a rewrite to vercel.json:

json
{
  "rewrites": [{ "source": "/_lg/:path*", "destination": "https://in.quickpipe.ai/:path*" }]
}

Netlify ​

Add this line to _redirects:

text
/_lg/*  https://in.quickpipe.ai/:splat  200

Nginx ​

Add this location to the server of your website:

nginx
location /_lg/ {
  proxy_pass https://in.quickpipe.ai/;
  proxy_ssl_server_name on;
  proxy_set_header Host in.quickpipe.ai;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Result ​

The client sends the events to your website. Your server or CDN sends them to QuickPipe. After consent, QuickPipe sets the cookie lg_aid through your website, and Safari keeps it for 13 months.