Set Up a First-Party Web Analytics Proxy on Netlify
Add redirects to netlify.toml to proxy web analytics through your own domain for more complete visitor and conversion tracking.
Add this to netlify.toml. Replace /_ds with a path of your own.
netlify.toml
[[redirects]]
from = "/_ds/js/script.cookies.js"
to = "https://usedataowl.com/js/script.cookies.js"
status = 200
force = true
[[redirects]]
from = "/_ds/api/e"
to = "https://usedataowl.com/api/e"
status = 200
force = true
[[redirects]]
from = "/_ds/api/p"
to = "https://usedataowl.com/api/p"
status = 200
force = true
# Session replay, if you turn it on
[[redirects]]
from = "/_ds/js/recorder.js"
to = "https://usedataowl.com/js/recorder.js"
status = 200
force = true
[[redirects]]
from = "/_ds/api/replay"
to = "https://usedataowl.com/api/replay"
status = 200
force = true
# Forms, if you create any
[[redirects]]
from = "/_ds/js/forms.js"
to = "https://usedataowl.com/js/forms.js"
status = 200
force = true
[[redirects]]
from = "/_ds/api/forms"
to = "https://usedataowl.com/api/forms"
status = 200
force = trueThen load the script from your own domain:
html
<script
defer
data-website-id="YOUR_SITE_ID"
src="/_ds/js/script.cookies.js"
></script>Verify
Open your site with an ad blocker on. In the browser's network tab, /_ds/js/script.cookies.js and /_ds/api/e load from your own domain, and the visit shows up on the Realtime page.