You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/sources/catalog/libraries/website/javascript/custom-proxy.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,22 +172,23 @@ To add a CNAME record to your DNS settings:
172
172
4. Run `curl` on your domain to check if the proxy is working correctly.
173
173
174
174
175
-
## Self-Hosting Analytics.js
176
-
Sometimes, users want to host as much as Segment on their own infrastructure as possible, for control or to minimize network calls.
175
+
## Self-Hosting Analytics.js, settings, and destinations
176
+
To reduce or eliminate fetching assets from Segment's CDN, you can bundle analytics.js with your own code.
177
+
177
178
178
179
Some things you can do:
179
180
1. Use [Analytics.js as an npm package](https://github.com/segmentio/analytics-next/tree/master/packages/browser#-using-as-an-npm-package).
180
181
181
-
2. Use [npm to bundle your destinations ](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#add-destinations-from-npm) with your own code instead of fetching them from the CDN.
182
+
2. Use [npm to bundle your destinations ](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#add-destinations-from-npm) with your own code instead of fetching them from the CDN (advanced optimization -- this is generally not neccessary).
182
183
183
184
184
-
3. Hardcode your settings instead of fetching from the CDN (Not recommended; this bypasses the Segment GUI completely).
185
+
3. Hardcode your settings instead of fetching from the CDN (not recommended -- bypass the Segment souce configuration GUI completely).
185
186
```ts
186
187
// npm-only
187
188
exportconst analytics =newAnalyticsBrowser()
188
189
analytics.load({
189
190
...
190
-
cdnSettings: 'Paste object from https://cdn.segment.com/v1/projects/<YOUR_WRITE_KEY>/settings'
191
+
cdnSettings: {...} // object from https://cdn.segment.com/v1/projects/<YOUR_WRITE_KEY>/settings'
0 commit comments