Skip to content

Commit b7d9c58

Browse files
authored
Analytics.js: Add FAQ about CSPs
- add section about whitelisting domains for customers using CSPs - this section was previously part of our "Upgrade to AJS 2.0" page, which is no longer readily accessible to customers
1 parent 91f066d commit b7d9c58

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/connections/sources/catalog/libraries/website/javascript/troubleshooting.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,24 @@ Regarding cookies set by [device-mode destinations](/docs/connections/destinatio
203203

204204
The Analytics.js library sets the `context.page.referrer` value from the `window.document.referrer` [property](https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer){:target="_blank"} set in the browser. If you notice unexpected referrer values reaching Segment, check how this value is being set on your website.
205205

206+
## Does Segment support using strict Content Security Policy (CSP) on the page?
207+
208+
If you are using a nonce-based security policy that allows JavaScript to be downloaded from specific locations, then you will need to update the CSP to account for all Segment domains. Therefore, beyond allowing the main `analytics.min.js` script, you should also allow the following paths in your CSP:
209+
- `https://cdn.segment.com/v1/projects/<WRITE_KEY>/settings`
210+
- `https://cdn.segment.com/analytics-next/bundles/*`
211+
- `https://cdn.segment.com/next-integrations/integrations/*`
212+
213+
Your CSP may also require whitelisting approved domains, in which case you'll want to allow the following endpoints:
214+
- `api.segment.io`
215+
- `api.segment.com`
216+
- `track.segment.com`
217+
- `cdn.segment.com`
218+
219+
You will also need to modify the Segment script with your `nonce` tag, which should match the value specified in your Content Security Policy.
220+
221+
> info ""
222+
> Since Segment interacts with several integrations, support surrounding Content Security Policy issues is limited.
223+
206224
## Known issues:
207225

208226
[Review and contribute to these on GitHub](https://github.com/segmentio/analytics.js/issues).

0 commit comments

Comments
 (0)