Skip to content

Commit

Permalink
Merge pull request #493 from audioverse-org/AV-640-Analytics.JS-Initi…
Browse files Browse the repository at this point in the history
…al-Setup

added basic segment to base.tsx but need to push to live for testing
  • Loading branch information
jlaverde77 authored Nov 7, 2023
2 parents 8c55504 + 9822a81 commit f55f5d2
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/containers/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,49 @@ function Base<P>({
<div className={styles.base}>
<React.StrictMode>
<Head>
<script
dangerouslySetInnerHTML={{
__html: `
!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(){
if(window.analytics.initialized)
return window.analytics[e].apply(window.analytics,arguments);
var i=Array.prototype.slice.call(arguments);
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="oTuJ7Ab15OkcWQH1nAQKcKewzi9sQL3k";
analytics.SNIPPET_VERSION="4.16.1";
analytics.load("oTuJ7Ab15OkcWQH1nAQKcKewzi9sQL3k");
analytics.page();
}
}();
`,
}}
/>
{/* eslint-disable-next-line @calm/react-intl/missing-formatted-message */}
<title>{title ? `${title} | AudioVerse` : 'AudioVerse'}</title>
{description && <meta name="description" content={description} />}
Expand All @@ -56,10 +99,12 @@ function Base<P>({
content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
/>
<meta name="theme-color" content="#efebeb" />

<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
</Head>

<Script
id="google-analytics"
strategy="afterInteractive"
Expand Down

1 comment on commit f55f5d2

@vercel
Copy link

@vercel vercel bot commented on f55f5d2 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.