Install DataPocket on NGINX
Updated
Two location blocks in your server config. Sign in and these snippets fill in your site ID and domain. Until then, swap YOUR_SITE_ID and YOUR_DOMAIN with the values from your Install page.
- 1
Inside your server { } block:
nginxlocation ~ ^/dp/js/(script(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js)$ { proxy_pass https://datapocket.vo1d.studio/js/$1; proxy_set_header Host datapocket.vo1d.studio; proxy_set_header Cookie ""; proxy_set_header Authorization ""; proxy_ssl_server_name on; proxy_hide_header Set-Cookie; } location = /dp/api/event { proxy_pass https://datapocket.vo1d.studio/api/event; proxy_set_header Host datapocket.vo1d.studio; proxy_set_header X-Forwarded-For $remote_addr; # proxy_pass forwards every request header: drop the visitor's cookies and credentials proxy_set_header Cookie ""; proxy_set_header Authorization ""; proxy_ssl_server_name on; proxy_hide_header Set-Cookie; } - 2
Reload (nginx -t && nginx -s reload), then:
html<script defer data-site-id="YOUR_SITE_ID" data-domain="YOUR_DOMAIN" src="/dp/js/script.js" ></script> - 3
Behind Cloudflare or a load balancer? Enable the realip module (set_real_ip_from + real_ip_header X-Forwarded-For) so $remote_addr is the visitor's IP.
Related guides
React RouterFramework mode (Remix) and library mode. pushState navigations are tracked automatically.
Vue.jsVue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically.
JavaScript appsReact, Vue, Svelte or Angular: the script tag with typed calls, plus server-side payments and goals over HTTP.
ExpressServe the script and forward events from your Express server.
- AI crawler trackingSee when ChatGPT, Claude and Perplexity read your pages. One server-side call.
- All install guides25 platforms, code and no-code.