forked from adamlaska/circleci-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsegment.html
More file actions
37 lines (32 loc) · 2.12 KB
/
segment.html
File metadata and controls
37 lines (32 loc) · 2.12 KB
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
<script type="text/javascript">
!function(){
/**
*
DD-261: Fix for cookie experiation date
if we are in production, we use the forked amplitude/segment that set cookie to a 1 year experiation date
otherwise we use the original amplitude/segment via CDN
*/
var isProduction = window.location.origin === 'https://circleci.com';
var segmentHost = isProduction ? 'https://cci-growth-utils.s3.us-east-2.amazonaws.com/segment/' : 'https://cdn.segment.com/';
/**
* this is the original snippet from the Amplitude/Segment documentation
* only difference is that it uses the segmentHost variable
*/
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","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=segmentHost+"analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";
analytics.load({{ site.segment | jsonify }});
var pageCategory = "docs";
/* slice off the slashes on either end */
var pageName = {{ page.url | jsonify }}.slice(1, -1) || "default";
var properties = {
"title" : {{ page["title"] | jsonify }},
"short-title": {{ page["short-title"] | jsonify }},
"categories" : {{ page["categories"] | jsonify }},
"description": {{ page["description"] | jsonify }},
"collection": {{ page["collection"] | jsonify }}
};
window.currentPage = {
name: pageName,
jekyllProperties: properties
};
}}();
</script>