Pixelex.Dashboard.Settings (Pixelex v0.2.0)

Copy Markdown View Source

Where a tenant sets up their own pixels, without a deploy and without you.

scope "/admin" do
  pipe_through [:browser, :require_admin]
  pixelex_dashboard "/analytics"
  pixelex_settings "/analytics/settings"
end

Paste anything

The form does not ask a marketer to know the difference between a pixel code, a measurement ID and an ad account ID. It takes the block of JavaScript their ad platform told them to install, finds the id inside it and fills in the right field on the right card — Pixelex.Destinations.Detect is the whole trick, and it works in the individual fields too, so pasting a snippet into Pixel ID is fine.

Test is the feature

Wrong credentials do not fail loudly. They produce a silent gap in reporting that somebody notices three weeks later while wondering why conversions fell off. So every configured card gets a Test button that sends a real page_view through the platform's live API and prints what came back. Setup is not "saved", it is "verified".

Secrets go in and do not come out

An access token is written, never rendered. The field shows Set or Not set; leaving it blank on save keeps the stored value, and Disconnect is how you remove one. With config :pixelex, secret_key: set they are encrypted at rest too — see Pixelex.Secrets.

It has no authentication, and here that matters more

Like the dashboard, this inherits the pipeline you scope it in. Unlike the dashboard it writes, so if you serve several tenants from one host, pin the site rather than letting ?site= choose it:

pixelex_settings "/analytics/settings", site_id: "acme"

or pass an :on_mount hook that checks the current user against the site they asked for. With a custom-domain product the host is the tenant and the default is already right.