-
Notifications
You must be signed in to change notification settings - Fork 3
/
StoragePriority.html
41 lines (40 loc) · 2.62 KB
/
StoragePriority.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Analytics.js Storage Priority Test</title>
<!-- Documentation Link -->
<link rel="stylesheet" href="https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/cookie-validity-update/#storage-priority">
<!-- SEGMENT SNIPPET-->
<script>
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","screen","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware","register"];analytics.factory=function(e){return function(){if(window.analytics.initialized)return window.analytics[e].apply(window.analytics,arguments);var i=Array.prototype.slice.call(arguments);if(["track","screen","alias","group","page","identify"].indexOf(e)>-1){var c=document.querySelector("link[rel='canonical']");i.push({__t:"bpc",c:c&&c.getAttribute("href")||void 0,p:location.pathname,u:location.href,s:location.search,t:document.title,r:document.referrer})}i.unshift(e);analytics.push(i);return analytics}};for(var i=0;i<analytics.methods.length;i++){var key=analytics.methods[i];analytics[key]=analytics.factory(key)}analytics.load=function(key,i){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);analytics._loadOptions=i};analytics._writeKey="30t6DSp4jMg8gMmr20XP3EEuuXzPKtS4";;analytics.SNIPPET_VERSION="5.2.0";
analytics.load("30t6DSp4jMg8gMmr20XP3EEuuXzPKtS4", {
// Global Storage Priority: Both User and Group data
// Specific Storage Priority
user: {
storage: {
stores: ['cookie']
}
},
group: {
storage: {
stores: ['localStorage']
}
},
})
analytics.page();
analytics.identify("123");
analytics.group("456");
}
}
();
</script>
<!-- SEGMENT SNIPPET-->
</head>
<body>
<h1>Analytics.js Storage Priority Test</h1>
<p>This page is designed to test the Analytics.js Storage Priority feature.</p>
<p>For more information, visit the <a href="https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/cookie-validity-update/#storage-priority">documentation</a>.</p>
</body>
</html>