DataLook Docs
Install guides

Phoenix (Elixir)

Install DataLook on Phoenix (Elixir) — the plain script tag, or the first-party proxy that beats ad blockers. Both on one page.

Add the tag to your root layout.

Add the script to root.html.heex <head>

lib/my_app_web/components/layouts/root.html.heex
<script defer src="https://cdn.datalook.app/s.js" data-site="YOUR_SITE_ID"></script>

The proxy install serves both s.js and the collector from your own domain, so ad blockers — which match on domain, not path — can't see us. You rewrite one innocuous path prefix to our CDN; the script figures out the rest.

Forward the prefix to ReverseProxyPlug in your router.

Add the deps

mix.exs
{:reverse_proxy_plug, "~> 3.0"},{:finch, "~> 0.18"}

Forward the prefix

lib/my_app_web/router.ex
forward "/_axis", ReverseProxyPlug,  upstream: "https://cdn.datalook.app",  client: ReverseProxyPlug.HTTPClient.Adapters.HTTPoison

Point the script at the prefix

<script defer src="/_axis/s.js" data-site="YOUR_SITE_ID"></script>

Heads up

Your server now sits between the visitor and us, so forward the visitor IP (X-Forwarded-For) or your country breakdown will collapse to your server location. The DNS proxy avoids this entirely — see the proxy overview.