Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Implement Segment.io baseline integration #651

Open
wdprice opened this issue Sep 23, 2020 · 2 comments
Open

Implement Segment.io baseline integration #651

wdprice opened this issue Sep 23, 2020 · 2 comments

Comments

@wdprice
Copy link

wdprice commented Sep 23, 2020

Implement the baseline analytics features we get from segment.

Page by page instrumentation is out of scope.

@wdprice wdprice added this to the v1.01 - Stability Release milestone Sep 23, 2020
@ajefts
Copy link

ajefts commented Sep 30, 2020

Here is the snippet you will need to add:

<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","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var key=analytics.methods[e];analytics[key]=analytics.factory(key)}analytics.load=function(key,e){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=e};analytics.SNIPPET_VERSION="4.13.1";
  analytics.load("zJNgNa43ENbl5ccJflkpDPncAXurQTUA");
  analytics.page();
  }}();
</script>

@callmekatootie
Copy link
Collaborator

Code copied into index.html.

The segment api key is under REACT_APP_SEGMENT_API_KEY env variable. We need to set it in prod and build the front end. Will be done when we sync prod with dev

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants