DEV Community

Takeshi Sawaki
Takeshi Sawaki

Posted on • Updated on

Introducing GTM to nuxt webapps.

When you introduce GTM to Nuxt.js, all you have to do is only 3 things.

  1. install a module
  2. insert GTM's id
  3. testing

1. install a module

Type a command below.

npm i @nuxtjs/gtm
or
yarn add @nuxtjs/gtm
Enter fullscreen mode Exit fullscreen mode

When you finish installing the module, move to next part.

2. insert GTM's id

Open a file named nuxt.config.js and insert GTM's id.

export default {
  modules: [
    '@nuxtjs/gtm',
  ],
  gtm: {
    id: 'GTM-XXXXXXX'
  }
}
Enter fullscreen mode Exit fullscreen mode

For other options, please check here.
https://github.com/nuxt-community/gtm-module#readme

3. testing

Install a add-on to chrome and test weather it is working correctly or not.
https://chrome.google.com/webstore/detail/tag-assistant-legacy-by-g/kejbdjndbnbjgmefkgdddjlbokphdefk

Writer
Takeshi Sawaki

CEO at CoDigital, inc. in Japan.
CoDigital, inc. is a Japanese Digital Marketing Agency.

・We primarily deal in digital marketing services such as Advertising, SEO, Social Media and introducing CRM / MA tools in Japan. ・We work with a variety of industries such as SaaS Companies, Staffing Agencies, Website Design Company, Media and Software and App developers providing digital marketing consulting, implementation and analyzing services.

Top comments (3)

Collapse
 
kissu profile image
Konstantin BIFERT

Hi. πŸ‘‹πŸ»
What is this GTM using as a version? I know that there are several and not all of them are compatible.

Collapse
 
takeshi_sawaki profile image
Takeshi Sawaki

Hello,
Are you asking for GTM version? OR Nuxt.js's version?

Collapse
 
kissu profile image
Konstantin BIFERT

Yeah, asking for GTM.