Skip to content

Commit 1c55516

Browse files
authored
edits
1 parent f873159 commit 1c55516

File tree

1 file changed

+14
-6
lines changed
  • src/connections/sources/catalog/libraries/website/javascript

1 file changed

+14
-6
lines changed

src/connections/sources/catalog/libraries/website/javascript/custom-proxy.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ You need to set up two important parts, regardless of the CDN provider you use:
3030
3131
## Set up
3232

33-
**Option 1**
33+
There are 2 options you can choose from when you set up your custom domain proxy.
34+
1. [Use CloudFront](#cloudfront)
35+
2. [Use a custom CDN or API proxy]
3436

35-
Follow the directions listed for CloudFront or use your own CDN setup. Once you complete those steps and verify that your proxy works for both `cdn.segment.com` and `api.segment.io`, [contact Segment Product Support](https://segment.com/help/contact/) with the following template email:
37+
Follow the directions listed for [CloudFront](#cloudfront) or [use your own CDN setup](#custom-cdn-api-proxy). Once you complete those steps and verify that your proxy works for both `cdn.segment.com` and `api.segment.io`, [contact Segment Product Support](https://segment.com/help/contact/) with the following template email:
3638

3739
```text
3840
Hi,
@@ -53,11 +55,10 @@ A Segment Customer Success team member will respond that they have enabled this
5355
> info ""
5456
> The **Host Address** field does not appear in source settings until it's enabled by Segment Customer Success.
5557
56-
**Option 2**
5758

5859
## Custom CDN / API Proxy
5960

60-
You can proxy settings and destination requests that typically go to `http://cdn.segment.com` through a custom proxy.
61+
Proxy settings and destination requests that typically go to `http://cdn.segment.com` through a custom proxy.
6162

6263
```ts
6364
const analytics = AnalyticsBrowser.load({
@@ -66,11 +67,11 @@ const analytics = AnalyticsBrowser.load({
6667
// https://MY-CUSTOM-CDN-PROXY.com/v1/project/<writekey>/settings
6768
// GET https://cdn.segment.com/next-integrations/actions/...js ->
6869
// https://MY-CUSTOM-CDN-PROXY.com/next-integrations/actions/...js
69-
cdnURL: 'https://MY-CUSTOM-CDN-PROXY.com' //
70+
cdnURL: 'https://MY-CUSTOM-CDN-PROXY.com'
7071
})
7172
```
7273

73-
You can proxy tracking calls that typically go to `api.segment.io/v1` by configuring `integrations['Segment.io'].apiHost`.
74+
Proxy tracking calls that typically go to `api.segment.io/v1` by configuring `integrations['Segment.io'].apiHost`.
7475
```ts
7576
const analytics = AnalyticsBrowser.load(
7677
{
@@ -88,6 +89,13 @@ const analytics = AnalyticsBrowser.load(
8889
)
8990
```
9091

92+
### Snippet instructions
93+
If you're a snippet user, you need to modify the [analytics snippet](/docs/getting-started/02-simple-install/#step-1-copy-the-snippet) that's inside your `<head>`.
94+
95+
To proxy settings and destination requests that typically go to `http://cdn.segment.com`, replace: `t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js"` with `t.src="https://MY-CUSTOM-CDN-PROXY.com" + key + "/analytics.min.js"`
96+
97+
To proxy tracking calls that typically go to `api.segment.io/v1`, replace `analytics.load("<MY_WRITE_KEY>")` with `analytics.load("<MY_WRITE_KEY>", { integrations: { "Segment.io": { apiHost: "MY-CUSTOM-API-PROXY.com" }}})`
98+
9199
## CloudFront
92100

93101
These instructions refer to Amazon CloudFront, but apply more generally to other providers as well.

0 commit comments

Comments
 (0)