|
| 1 | +--- |
| 2 | +title: Analytics.js 2.0 (Beta) |
| 3 | +strat: ajs |
| 4 | +--- |
| 5 | +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. |
| 6 | + |
| 7 | +## Benefits of Analytics.js 2.0 |
| 8 | + |
| 9 | +The Analytics.js 2.0 Beta provides two key benefits over the previous version. |
| 10 | + |
| 11 | +### Performance |
| 12 | + |
| 13 | +Analytics.js 2.0 provides a reduction in page load time, which improves overall site performance. Its package size is **~70%** smaller than the previous Analytics.js. |
| 14 | + |
| 15 | +> info "" |
| 16 | +> There are many factors that impact page load time, including page weight, network conditions, and hosting locations. |
| 17 | +
|
| 18 | +### Developer experience |
| 19 | + |
| 20 | +Analytics.js 2.0 introduces new ways for developers to augment events throughout the event timeline. This enables teams to support: |
| 21 | + |
| 22 | +- New privacy and consent controls before an event occurs |
| 23 | +- Enriching events with additional customer or page context in-flight using middleware |
| 24 | +- Collecting better metrics related to deliverability *after* a message is sent |
| 25 | + |
| 26 | +## Start using Analytics.js 2.0 |
| 27 | + |
| 28 | +Analytics.js is released as a Public Beta, on an opt-in basis, *per source*. The updated code is delivered through your existing snippet, so there's no need to update code on your site. |
| 29 | + |
| 30 | +To opt in: |
| 31 | + |
| 32 | +1. Navigate to the **Settings** tab of the javascript source you want to enable. |
| 33 | +2. Enable the Analytics 2.0 toggle. |
| 34 | + |
| 35 | +Once enabled, after 5 minutes or less, the updated code is delivered. |
| 36 | + |
| 37 | +## Disable Analytics.js 2.0 |
| 38 | + |
| 39 | +To revert back to the previous version of Analytics.js, disable the Analytics 2.0 toggle on any source you've enabled it. |
| 40 | + |
| 41 | +## Open source libraries |
| 42 | + |
| 43 | +Analytics.js 2.0 includes the following open source components: |
| 44 | + |
| 45 | +**uuid v2.0.0** ([https://github.com/lukeed/uuid](https://github.com/lukeed/uuid)) |
| 46 | +Copyright Luke Edwards < [[email protected]](mailto:[email protected])> ( [lukeed.com ](lukeed.com)) |
| 47 | +License: MIT License, available here: [https://github.com/lukeed/uuid/blob/master/license](https://github.com/lukeed/uuid/blob/master/license) |
| 48 | + |
| 49 | +**component-url v0.2.1** ([https://github.com/component/url](https://github.com/component/url)) |
| 50 | +Copyright (c) 2014 Component |
| 51 | +License: MIT License, available here: [https://github.com/component/url/blob/master/Readme.md](https://github.com/component/url/blob/master/Readme.md) |
| 52 | + |
| 53 | +**dset v2.0.1** ([https://github.com/lukeed/dset](https://github.com/lukeed/dset)) |
| 54 | +Copyright (c) Luke Edwards < [[email protected]](mailto:[email protected])> ( [lukeed.com ](lukeed.com)) |
| 55 | +License: MIT License, available here: [https://github.com/lukeed/dset/blob/master/license](https://github.com/lukeed/dset/blob/master/license) |
| 56 | + |
| 57 | +**js-cookie v2.2.1** |
| 58 | +Copyright (c) 2018 Copyright 2018 Klaus Hartl, Fagner Brack, GitHub Contributors |
| 59 | + License: MIT License, available here: [https://github.com/js-cookie/js-cookie/blob/master/LICENSE](https://github.com/js-cookie/js-cookie/blob/master/LICENSE) |
| 60 | + |
| 61 | +**md5 v2.3.0** ([https://github.com/pvorb/node-md5](https://github.com/pvorb/node-md5)) |
| 62 | +Copyright (c) 2011-2012, Paul Vorbach. |
| 63 | +Copyright (c) 2009, Jeff Mott. |
| 64 | +License: BSD-3-Clause “New” or “Revised” License, available at: |
| 65 | +[https://github.com/pvorb/node-md5/blob/master/LICENSE](https://github.com/pvorb/node-md5/blob/master/LICENSE) |
| 66 | + |
| 67 | +**unfetch v4.1.0** ([https://github.com/developit/unfetch](https://github.com/developit/unfetch)) |
| 68 | +Copyright (c) 2017 Jason Miller |
| 69 | +License: MIT License, available at: [https://github.com/developit/unfetch/blob/master/LICENSE.md](https://github.com/developit/unfetch/blob/master/LICENSE.md) |
0 commit comments