Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/_data/sidenav/strat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ sections:
section:
- path: /connections/sources/catalog/libraries/website/javascript
title: Analytics.js (Javascript) Source
# - path: /connections/sources/catalog/libraries/website/javascript/analytics-js-2
# title: Analytics.js 2.0 (Beta)
- path: /connections/sources/catalog/libraries/website/javascript/analytics-js-2
title: Analytics.js 2.0 (Beta)
- path: /connections/sources/catalog/libraries/website/javascript/supported-browsers
title: Analytics.js supported browsers
- path: /connections/sources/catalog/libraries/website/javascript/quickstart
Expand Down
20 changes: 20 additions & 0 deletions src/_release_notes/2021-03-10-ajs-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Analytics.js 2.0
description: |
Analytics.js is Segment’s most popular library source. This new major version has been re-engineered to be more performant and provide greater extensibility. It is fully backwards compatible with the previous version of Analytics.js.
release_type: beta
product_area: sources
business: false
team: false
doc_links:
-
title: Analytics.js 2.0 (Beta)
url: "/docs/connections/sources/catalog/libraries/website/javascript/analytics-js-2/"
# images:
# -
# path: /images/release-notes/ui-update-1.png
# desc: The navigation was redesigned to better reflect how users navigate through the product.
# -
# path: /images/release-notes/ui-update-2.gif
# desc: A new workspace switcher provides an easier way to navigate between workspaces.
---
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: Analytics.js 2.0 (Beta)
strat: ajs
hidden: true
---
> warning "Analytics.js 2.0 is recommended for use in staging"
> Analytics.js 2.0 was built with backwards compatibility in mind. However, Segment recommends thorough testing in a Staging environment before you upgrade your production source.
Expand Down Expand Up @@ -43,14 +42,15 @@ Once enabled, after 5 minutes or less, the updated code is delivered.
To revert back to the previous version of Analytics.js, disable the Analytics 2.0 toggle on any source you've enabled it.

## Cases that require manual upgrade
We identified the following two cases where upgrading Analytics 2.0 requires manual effort beyond just enabling the Analytics 2.0 toggle.
There are two cases where upgrading to Analytics.js 2.0 requires manual effort beyond enabling the Analytics.js 2.0 toggle.

### When using in-domain instrumentation CDN aliasing
If your source uses the in-domain instrumentation as well as a custom "Alias for analytics.js", then you should update the AJS snippet to the latest version (4.13.2
or higher) before toggling Analytics 2.0 on.

If the source you intend to upgrade uses the in-domain instrumentation as well as a custom "Alias for analytics.js", then you should update the AJS snippet to the latest version (4.13.2 or higher) before you toggle on Analytics.js 2.0.

### When using a strict content security policy on the page
Analytics 2.0 asynchronously loads different pieces of the library as needed, and therefore, if your source uses a strict Content Security Policy (CSP) that allows Javascript to be downloaded from specific locations, then you need to update the CSP to account for all the pieces used for Analytics 2.0. Therefore, beyond allowing the main analytics.min.js script, you should allow the following paths in your CSP:

Analytics.js 2.0 asynchronously loads different pieces of the library as needed. If the source you're upgrading uses a strict Content Security Policy (CSP) that allows Javascript to be downloaded from specific locations, then you need to update the CSP to account for all the pieces used for Analytics.js 2.0. Therefore, beyond allowing the main analytics.min.js script, you should allow the following paths in your CSP:
- `https://cdn.segment.com/v1/projects/<WRITE_KEY>/settings`
- `https://cdn.segment.com/analytics-next/bundles/*`
- `https://cdn.segment.com/next-integrations/integrations/*`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ strat: ajs

Analytics.js, Segment's Javascript source, makes it simple to send your data to any tool without having to learn, test or implement a new API every time.

> info "Analytics.js 2.0 Beta"
> A new version of Analytics.js is available for use in Beta. Click [here](/docs/connections/sources/catalog/libraries/website/javascript/analytics-js-2) for more information.

## Getting Started

Read through the [Analytics.js QuickStart Guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/) which explains how to add Analytics.js to your site in just a few minutes. Once you've installed the library, read on for the detailed API reference!
Expand Down