Skip to content

Commit 9da5f1c

Browse files
sarahrudymarkzegarelli
andauthored
Add files for custom proxy with AJS 2.0 (#4140)
* Add files for custom proxy with AJS 2.0 * Vale updates --------- Co-authored-by: markzegarelli <[email protected]>
1 parent 0c57982 commit 9da5f1c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/connections/sources/catalog/libraries/website/javascript/upgrade-to-ajs2.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,25 @@ Analytics.js 2.0 asynchronously loads different pieces of the library as needed.
6060

6161
Previously, it was possible to attach `trackLink` to any element, and a `trackLink` call would fire for that element if it wasn't a link. Now, when you attach `trackLink` to a non-link element, an additional search of that element's children occurs for any nested links and fires track calls based on those links. If you wish to fire track calls on non-link elements that have links as children, you can use a `track` call instead.
6262

63+
### Using a custom proxy
64+
65+
Analytics.js 2.0 loads new files not usually loaded with Analytics.js Classic, so you'll also need to make sure these new files are considered in your proxy configuration. If the new files are not considered, Analytics.js 2.0 falls back to `cdn.segment.com`. You'll have to proxy the rest of the files used by Analytics.js 2.0 using a scheme similar to Segment's CDN. You have two options:
66+
67+
**Option 1**: Update the proxy so that:
68+
69+
`https://cdn.yourdomain.com/analytics.js/*` maps to `https://cdn.segment.com/analytics.js/*`
70+
`https://cdn.yourdomain.com/analytics.js/*` maps to `https://cdn.segment.com/v1/*`
71+
`https://cdn.yourdomain.com/analytics-next/*` maps to `https://cdn.segment.com/analytics-next/*`
72+
`https://cdn.yourdomain.com/next-integrations/*` maps to `https://cdn.segment.com/next-integrations/*`
73+
74+
**Option 2**: Map `cdn.yourdomain.com/*` to `https://cdn.segment.com/*`
75+
76+
After that, serve AJS from `https://cdn.yourdomain.com/analytics.js/v1/<YOUR_WRITE_KEY>/analytics.min.js` and everything will be fetched from your proxy.
77+
6378
## FAQs
6479

6580
### I'm already using Analytics 2.0, why am I still receiving the message to upgrade?
66-
It's possible that a different source you're using is still leveraging an older version of Analytics.js. A way to see which sources are on which versions is to go to the source overview page, then filter on the Analytics.js version.
81+
It's possible that a different source you're using uses an older version of Analytics.js. A way to see which sources are on which versions is to go to the source overview page, then filter on the Analytics.js version.
6782

6883
It's also possible that you have used a write key from another source type (like Ruby) to instrument your JavaScript source. To upgrade these sources, you may need to create a new JavaScript source and replace the write key.
6984

0 commit comments

Comments
 (0)