vuepress-plugin-google-tag-manager

vuepress-plugin-google-tag-manager plugin for vuepress
24,924 7
Install
npm install vuepress-plugin-google-tag-manager
Latest Version:0.0.5
License:MIT
Last Updated:Mar 3, 2026
Links: GitHub  ·  npm
Maintainer: bykclk

vuepress-plugin-google-tag-manager

vuepress-plugin-google-tag-manager plugin for vuepress

Install

npm i vuepress-plugin-google-tag-manager --save

or

yarn add vuepress-plugin-google-tag-manager

Configuration

module.exports = {
  plugins: ['vuepress-plugin-google-tag-manager'] 
}

Options

gtm

  • Type: string
  • Default: undefined

Provide the Google Tag Manager ID to enable integration.

Documentation

Once the configuration is completed, you can access vue gtm instance in your components like that :

export default {
  name: 'MyComponent',
  data() {
    return {
      someData: false
    };
  },
  methods: {
    onClick: function() {
      this.$gtm.trackEvent({
        event: null, // Event type [default = 'interaction'] (Optional)
        category: 'Calculator',
        action: 'click',
        label: 'Home page SIP calculator',
        value: 5000,
        noninteraction: false // Optional
      });
    }
  },
  mounted() {
    this.$gtm.trackView('MyScreenName', 'currentpath');
  }
};

The passed variables are mapped with GTM data layer as follows

dataLayer.push({
	'event': event || 'interaction',
	'target': category,
	'action': action,
	'target-properties': label,
	'value': value,
	'interaction-type': noninteraction,
	...rest
});

Related Packages

@vuepress/plugin-nprogress

nprogress plugin for vuepress

3,258,429 22,716
@vuepress/plugin-active-header-links

active-header-links plugin for vuepress

3,218,918 22,716
@vuepress/theme-default

Default theme for VuePress

3,076,688 22,716
@vuepress/plugin-search

search plugin for vuepress

2,580,346 22,716
@vuepress/plugin-register-components

register-global-components plugin for vuepress

2,557,918 22,716

Version History

Version Released License
0.0.5 MIT
0.0.4 MIT
0.0.3 MIT
0.0.2 MIT