Nuxt.js - GTM
export const pushGtmEvent = (event = 'nuxt.historyChange) => {
if(window.dataLayer) {
setTimeout(() => {
window.dataLayer.push({ event })
}, 500)
}
}
<script>
import pushGtmEvent from '~/utils/gtm'
export default {
mounted() {
this.$nextTick(() => {
pushGtmEvent()
})
}
}
</script>