Skip to content

Commit

Permalink
Merge pull request #24 from monster1935/feature/analysis
Browse files Browse the repository at this point in the history
fix: try to fix data report
  • Loading branch information
monster1935 authored Jun 7, 2024
2 parents 75cb0ce + 7b52c8b commit 6564686
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions plugins/ga.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
if (process.client && process.env.NODE_ENV === 'production') {
console.log('Data connected!')
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '');
gtag('config', 'G-ST120Y7Q6Y');
}

export default ({ app: { router }, store }) => {
if (process.client && process.env.NODE_ENV === 'production') {
router.afterEach((to, from) => {
ga('set', 'page', to.fullPath)
ga('send', 'pageview')
})
}
if (process.client && process.env.NODE_ENV === 'production') {
router.afterEach((to, from) => {
ga('set', 'page', to.fullPath)
ga('send', 'pageview')
})
}
}

0 comments on commit 6564686

Please sign in to comment.