Skip to content

Commit dd75cb2

Browse files
authored
Merge branch 'master' into niall/update_idfa_react
2 parents c4d5530 + 56e0d4e commit dd75cb2

File tree

7 files changed

+184
-173
lines changed

7 files changed

+184
-173
lines changed

src/_data/sidenav/strat.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ sections:
6666
title: Analytics.js Supported Browsers
6767
- path: /connections/sources/catalog/libraries/website/javascript/quickstart
6868
title: Quickstart Tutorial
69+
- path: /connections/sources/catalog/libraries/website/javascript/custom-proxy
70+
title: Custom Proxy for Analytics.js
6971
- path: /connections/sources/catalog/libraries/website/javascript/identity
7072
title: Managing identity in Analytics.js
7173
- path: /connections/sources/catalog/libraries/website/javascript/middleware
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
title: Set up a custom domain proxy for Analytics.js
3+
redirect_from: '/connections/sources/custom-domains/'
4+
strat: ajs
5+
---
6+
7+
Custom domains allow you to proxy Analytics.js and proxy all tracking event requests through your domain.
8+
9+
> success ""
10+
> Business Tier customers who want to use a fully-managed proxy service can contact their account teams for full details.
11+
12+
## Prerequisites
13+
14+
To set up a custom domain, you need:
15+
16+
1. Access to your site DNS settings
17+
2. A CDN you can serve assets from
18+
3. Access to the CDN settings
19+
20+
This guide explains how to set up a custom domain in Cloudfront. The same principles can be applied to almost any modern CDN that supports proxying.
21+
22+
You need to set up two important parts, regardless of the CDN provider you use:
23+
- Proxy to Segment CDN (`cdn.segment.com`)
24+
- Proxy to Segment tracking API (`api.segment.io`)
25+
26+
## Set up
27+
28+
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:
29+
30+
```text
31+
Hi,
32+
33+
This is {person} from {company}. I would like to request that you add a proxy for the following source(s) to point to the corresponding proxy url:
34+
35+
* Source {link to source in Segment} with source ID {source id} should point to {api host}
36+
* Source {link to source in Segment} with source ID {source id} should point to {api host}
37+
```
38+
39+
Double-check the source link, the Source ID, and the api proxy host to make sure they are correct. A member of our Success team will respond and set up the proxy for you.
40+
41+
## Cloudfront
42+
43+
### CDN Proxy
44+
45+
First log in to AWS and navigate to CloudFront.
46+
47+
![](images/create_cloudfront_distribution.png)
48+
49+
Click **Create Distribution**.
50+
51+
Select a delivery method for your content. Click **Get Started** in the **Web** section.
52+
53+
![](images/cloudfront_distribution_web.png)
54+
55+
Next, configure the distribution settings. Under Origin Settings, update the following values:
56+
57+
![](images/cloudfront_distribution_settings.png)
58+
59+
<table>
60+
<tr>
61+
<td>**Field**</td>
62+
<td>**Value**</td>
63+
<td>**Description**</td>
64+
</tr>
65+
<tr>
66+
<td>Origin Domain Name</td>
67+
<td>`cdn.segment.com`</td>
68+
<td>The domain name you want the proxy to be served to</td>
69+
</tr>
70+
<tr>
71+
<td>Origin ID (optional)</td>
72+
<td>The Segment CDN</td>
73+
<td>A Description of the origin. This can be anything you want that describes the origin domain name.</td>
74+
</tr>
75+
<tr>
76+
<td>Origin Protocol Policy</td>
77+
<td>Set to `HTTPS Only`</td>
78+
<td></td>
79+
</tr>
80+
<tr>
81+
<td>Alternate Domain Names (CNAMEs)</td>
82+
<td>yourdomain.com</td>
83+
<td>Add the domain you are proxying to Segment here. If you don't do this you will get an error.</td>
84+
</tr>
85+
</table>
86+
87+
Next, configure the **Default Cache Behavior Settings**.
88+
89+
<table>
90+
<tr>
91+
<td>**Field**</td>
92+
<td>**Value**</td>
93+
<td>**Description**</td>
94+
</tr>
95+
<tr>
96+
<td>Viewer Protocol Policy</td>
97+
<td>Redirect HTTP to HTTPS</td>
98+
<td>Ensure that all traffic goes through HTTPS</td>
99+
</tr>
100+
<tr>
101+
<td>Allowed HTTP Methods</td>
102+
<td>GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE</td>
103+
<td>Select which HTTP methods are allowed to be proxied.</td>
104+
</tr>
105+
<tr>
106+
<td>Forward Cookies</td>
107+
<td>All</td>
108+
<td>Ensure that cookies are forwarded.</td>
109+
</tr>
110+
<tr>
111+
<td>Query String Forwarding and Caching</td>
112+
<td>Forward all, cache based on all</td>
113+
<td>Ensure that all query string values are forwarded and properly cached.</td>
114+
</tr>
115+
</table>
116+
117+
Click **Create Distribution** at the bottom of the page. This distribution displays as being "In Progress" until it finishes deploying.
118+
119+
You need the "Domain Name" for the next step, so keep this browser window open.
120+
121+
#### Add CNAME Record to DNS
122+
123+
Next, add a CNAME record to your DNS settings. Go to your domain registrar and add a new record to your DNS of type "CNAME".
124+
125+
<table>
126+
<tr>
127+
<td>**Field**</td>
128+
<td>**Value**</td>
129+
</tr>
130+
<tr>
131+
<td>Name</td>
132+
<td>{subdomain_name}.yourdomain.com</td>
133+
</tr>
134+
<tr>
135+
<td>Value</td>
136+
<td>Cloudfront Distribution Domain Name</td>
137+
</tr>
138+
</table>
139+
140+
Save your record. This might take some time to take effect, depending on your TTL settings. Try `curl`ing your domain to check if it is proxying correctly.
141+
142+
### Tracking API Proxy
143+
144+
Next, set up a proxy for the tracking API so that all calls are proxied through your domain. In this step, we set up a Cloudfront distribution that's very similar to the previous step, with a few minor changes:
145+
146+
<table>
147+
<tr>
148+
<td>**Field**</td>
149+
<td>**Value**</td>
150+
<td>**Description**</td>
151+
</tr>
152+
<tr>
153+
<td>Origin Domain Name</td>
154+
<td>api.segment.io</td>
155+
<td>The domain name you would like the proxy to be served to</td>
156+
</tr>
157+
</table>
158+
159+
#### Add CNAME Record to DNS
160+
161+
Next, add a CNAME record to your DNS settings. Go to your domain registrar and add a new record to your DNS of type "CNAME". This time use the Cloudfront distribution for the tracking API proxy.
162+
163+
<table>
164+
<tr>
165+
<td>**Field**</td>
166+
<td>**Value**</td>
167+
</tr>
168+
<tr>
169+
<td>Name</td>
170+
<td>{subdomain_name}.yourdomain.com</td>
171+
</tr>
172+
<tr>
173+
<td>Value</td>
174+
<td>Tracking API Cloudfront Distribution Domain Name</td>
175+
</tr>
176+
</table>
177+
178+
Save your record. This might take some time to take effect, depending on your TTL settings. Try `curl`ing your domain to check if it is proxying correctly.

src/connections/sources/catalog/libraries/website/javascript/supported-browsers.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Analytics.js Browser Support
3-
redirect_from: '/guides/intelligent-tracking-prevention'
3+
redirect_from: '/guides/intelligent-tracking-prevention/'
44
strat: ajs
55
---
66

@@ -33,7 +33,9 @@ For example, [Firefox Enhanced Tracking Protection (ETP)](https://blog.mozilla.o
3333
3434
## Proxying Analytics.js
3535

36-
Because of regulatory, environmental, or security concerns, some customers prefer to set up proxy infrastructure for Analytics.js. You can use the `apihost` configuration option in the Analytics object to route traffic to different API endpoints. Business Tier customers can use Segment’s fully-managed proxy service: In-domain Instrumentation, which provides a similar function without the additional maintenance burden and cost of running your own proxy infrastructure.
36+
Because of regulatory, environmental, or security concerns, some customers prefer to [set up proxy infrastructure for Analytics.js](/docs/connections/sources/catalog/libraries/website/javascript/custom-proxy/).
37+
38+
You can also use the `apihost` configuration option in the Analytics object to route traffic to different API endpoints. Business Tier customers can use Segment’s fully-managed proxy service: In-domain Instrumentation, which provides a similar function without the additional maintenance burden and cost of running your own proxy infrastructure.
3739

3840
> info ""
3941
> Business Tier customers who want to use a fully-managed proxy service can contact their account teams for full details.

src/connections/sources/custom-domains.md

Lines changed: 0 additions & 171 deletions
This file was deleted.

0 commit comments

Comments
 (0)