Skip to content

Commit

Permalink
[C-2940] Update google analytics tags and fix embed build (#3856)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson committed Aug 7, 2023
1 parent 3469c89 commit 6f4fc89
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 43 deletions.
54 changes: 27 additions & 27 deletions packages/embed/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"webpack-cli": "4.5.0"
},
"dependencies": {
"@audius/sdk": "3.0.3-beta.109",
"@audius/sdk": "3.0.3",
"@audius/stems": "1.5.36",
"amplitude-js": "8.11.1",
"axios": "0.19.2",
Expand Down
8 changes: 7 additions & 1 deletion packages/embed/preact.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { resolve } from 'path'
import preactSVGLoader from 'preact-cli-svg-loader'

import envVars from 'preact-cli-plugin-env-vars'
import preactSVGLoader from 'preact-cli-svg-loader'

const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')

export default function (config, env, helpers) {
Expand All @@ -12,6 +14,10 @@ export default function (config, env, helpers) {
'src',
'index'
)
config.resolve.alias = {
...config.resolve.alias,
fs: resolve(__dirname, './src/util/empty.js')
}

// Inject env vars
envVars(config, env, helpers)
Expand Down
4 changes: 2 additions & 2 deletions packages/embed/src/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- start Google Analytics -->
<script
async
src="/embed/assets/scripts/gtag.js?id=UA-120325397-2"
src="/embed/assets/scripts/gtag.js?id=G-V6N1ZTVGS5"
></script>
<script>
try {
Expand All @@ -20,7 +20,7 @@
dataLayer.push(arguments)
}
gtag('js', new Date())
gtag('config', 'UA-120325397-2')
gtag('config', 'G-V6N1ZTVGS5')
} catch (e) {}
</script>
<!-- end Google Analytics -->
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion packages/web/.env/.env.prod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ REACT_APP_SOL_TOKEN_BRIDGE_ADDRESS=wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb

REACT_APP_METADATA_PROGRAM_ID=metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s

REACT_APP_GA_MEASUREMENT_ID=UA-120325397-2
REACT_APP_GA_MEASUREMENT_ID=G-V6N1ZTVGS5

REACT_APP_PUBLIC_PROTOCOL=https:
REACT_APP_PUBLIC_HOSTNAME=audius.co
Expand Down
18 changes: 7 additions & 11 deletions packages/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,17 @@
console.error(e)
}
</script>

<!-- start Google Analytics -->
<script async src="%PUBLIC_URL%/analytics/gtag.js?id=%REACT_APP_GA_MEASUREMENT_ID%"></script>
<script async>
<script async src="https://www.googletagmanager.com/gtag/js?id=%REACT_APP_GA_MEASUREMENT_ID%"></script>
<script>
const nodeEnv = '%NODE_ENV%'
const reactEnv = '%REACT_APP_ENVIRONMENT%'
if (nodeEnv === 'production' && reactEnv === 'production') {
try {
window.dataLayer = window.dataLayer || [];
// Stolen from https://github.com/gatsbyjs/gatsby/issues/11431
function gtag(){window.dataLayer && window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '%REACT_APP_GA_MEASUREMENT_ID%');
} catch (e) {
console.error(e)
}
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '%REACT_APP_GA_MEASUREMENT_ID%');
}
</script>
<!-- end Google Analytics -->
Expand Down

0 comments on commit 6f4fc89

Please sign in to comment.