Skip to content

Commit

Permalink
📦 chore(extend-html.ts): add new plugin to extend HTML with Google Ta…
Browse files Browse the repository at this point in the history
…g Manager script
  • Loading branch information
danieldanielecki committed Nov 20, 2023
1 parent 94dcb1f commit 45559d3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/plugins/extend-html.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('render:html', (html, { event }) => {
html.head.push(
`<script async src='https://www.googletagmanager.com/gtag/js?id=AW-924524631'></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'AW-924524631');</script>`,
)
})
})

0 comments on commit 45559d3

Please # to comment.