Sending events through your own domain
Some browsers and extensions block requests to analytics hosts. Serving the script and the event endpoint from your own domain avoids most of that.
Point the script at your proxy
Use data-api to send events somewhere other than the script's own host:
<script defer data-domain="example.com" data-api="https://example.com/stats/event" src="https://example.com/stats/script.js"></script>
Proxy rules
Forward two paths to your Tidemark installation:
| Your path | Forwards to |
|---|---|
/stats/script.js |
https://stats.example.com/js/script.js |
/stats/event |
https://stats.example.com/api/event |
Pass the original client IP in X-Forwarded-For so locations and shields keep working. Make sure the proxy sends the visitor's User-Agent too.
Note:
Tidemark reads the client IP from the first header it finds out of
CF-Connecting-IP,X-Client-IP,X-Forwarded-For,X-Real-IP,X-Appengine-User-IpandTrue-Client-IP.