Glancygrowth analytics
UnderstandImproveMonitorReplace your stackPricing
Log in
Getting started
  • Introduction
  • Quickstart
  • Events, users and sessions
  • Turning features on and off
SDKs
  • Script tag (glancy.js)
  • JavaScript (npm)
  • Next.js
  • React Native and Expo
  • iOS and macOS (Swift)
  • Android and JVM (Kotlin)
  • WordPress
  • Segment
  • Content Security Policy
Understand
  • Overview, real time and reports
  • Saved reports and dashboards
  • Session replay and heatmaps
  • Ad attribution
  • Ask AI
Improve
  • A/B testing
Monitor
  • Performance (web vitals)
  • Errors
  • Uptime
  • Monitoring and notifications
Data and privacy
  • Integrations and Shopify
  • Autocapture and actions
  • Ad conversions (Meta, Google Ads, TikTok, Taboola)
  • Privacy and your data
  • Cookie banner and consent
Account and reference
  • Organizations, people and usage
  • HTTP API

Content Security Policy

You only need this page if your site sends a Content-Security-Policy header (or a <meta http-equiv> tag with one). Most sites don't, and then Glancy works with nothing to configure.

With a policy, the browser blocks every address the policy doesn't list, so Glancy's address has to be on it. Everything the SDKs load and send goes to one address, your Glancy's: https://ingest.heyglancy.com. You allow that one address, not a list of third parties.

#The snippet

Add these sources to the directives your policy already has (don't replace your policy with it):

script-src 'self' https://ingest.heyglancy.com;
connect-src 'self' https://ingest.heyglancy.com;
img-src 'self' https://ingest.heyglancy.com;
style-src 'self' 'unsafe-inline';
frame-ancestors 'self' https://app.heyglancy.com;

script-src and connect-src are the ones every site needs. The others are only for the features in the table below: leave out the lines for features you don't use.

Test a change with Content-Security-Policy-Report-Only first: the browser then reports what it would block in its console ("Refused to connect to…", "Refused to load the script…") without blocking anything.

#What each line is for

Directive Source Needed for
script-src https://ingest.heyglancy.com The script tag and the WordPress plugin: glancy.js and the files it fetches for each feature (what it loads). The npm and Next.js SDKs are part of your own bundle, but fetch the cookie banner, A/B tests and the visual editor from this address too.
connect-src https://ingest.heyglancy.com Every SDK: events, replays, heatmaps, autocapture, web vitals and errors are sent here, and your site's settings (features, cookie banner, A/B tests) are read from here. Without it nothing reaches Glancy.
style-src 'unsafe-inline' The cookie banner's look, A/B tests with CSS changes or HTML that has style attributes, and the visual editor. Without it the banner shows unstyled and those changes don't apply.
img-src https://ingest.heyglancy.com Images you upload in the A/B test visual editor. Images from other addresses in your tests need those addresses here.
frame-ancestors https://app.heyglancy.com Showing your live site behind a heatmap. Optional: without it (or with X-Frame-Options), Glancy draws the heatmap on a recorded visit instead.

Session replay, heatmaps, autocapture, web vitals and errors need nothing beyond script-src and connect-src.

#Inline scripts

Glancy's own files are never inline, but a few snippets you may add are. A policy without 'unsafe-inline' in script-src blocks them unless you give each one your policy's nonce (or allow its hash):

  • The optional queue stub on the script tag (window.glancy=window.glancy||…), for calls made before glancy.js has loaded.
  • The anti-flicker snippet for A/B tests, a <style> and a <script>.
  • Scripts waiting for consent (data-glancy-consent): when their category is allowed, Glancy runs them as new scripts and carries the held tag's nonce over. Put your page's nonce on the held tag. Held scripts with a src also need that address in script-src, as they would without Glancy.
  • The WordPress plugin prints small inline scripts (the queue, WooCommerce events, event mapping) without a nonce. With a strict policy, page views, heatmaps and replays still work, but those browser events are blocked; the events it sends from the server (orders, sign-ups, forms) are not affected.

#Another address

If you set data-host on the script tag, or host in the npm or Next.js SDK, use that address in place of https://ingest.heyglancy.com. Your server-side SDKs aren't affected by any of this: a Content Security Policy only applies in the browser.

Previous
Segment
Next
Overview, real time and reports
On this page
  • The snippet
  • What each line is for
  • Inline scripts
  • Another address
Log in