Skip to content

Commit

Permalink
adding google analytics tag
Browse files Browse the repository at this point in the history
  • Loading branch information
atheer0998 committed Jan 25, 2024
1 parent 9059461 commit 512da2c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default {
src: '~/plugins/facebook.js', mode: 'client'
},
{ src: '~/plugins/gtag-conversion.js', mode: 'client' },
{ src: '~/plugins/google-analytics.js', mode: 'client' }
],

buildModules: [
Expand Down
12 changes: 12 additions & 0 deletions plugins/google-analytics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if (process.client) {
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'AW-11170063115');

let script = document.createElement('script');
script.async = true;
script.src = 'https://www.googletagmanager.com/gtag/js?id=AW-11170063115';
document.head.appendChild(script);
}

0 comments on commit 512da2c

Please sign in to comment.