TypeScript support for @analytics/google-tag-manager
See original GitHub issueI am using @analytics/google-tag-manager. I saw analytics have TypeScript support while @analytics/google-tag-manager not.
When add
import googleTagManager from '@analytics/google-tag-manager';
got
TS7016: Could not find a declaration file for module ‘@analytics/google-tag-manager’. ‘/hongbomiao.com/client/node_modules/@analytics/google-tag-manager/lib/analytics-plugin-google-tag-manager.cjs.js’ implicitly has an ‘any’ type. Try
npm install @types/analytics__google-tag-manager
if it exists or add a new declaration (.d.ts) file containingdeclare module '@analytics/google-tag-manager';
It would be great to add TypeScript in future. Thanks! : )
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:10 (2 by maintainers)
Top Results From Across the Web
@analytics/google-tag-manager - npm
Google tag manager plugin for 'analytics ' module. Latest version: 0.5.3, last published: 2 months ago.
Read more >How to use google analytics in typescript and access dataLayer
declare var dataLayer: GoogleAnalyticsCode; //This fails: dataLayer.push({ 'event' : 'LoginSuccess' }); //This is OK with typescript but I'm not ...
Read more >Using NextJS with Google Analytics and TypeScript
Google Analytics is an incredibly popular free tool used to track users, browsers and devices. NextJS is the best way to create React ......
Read more >TypeScript and Google Publisher Tags
Since TypeScript is a superset of JavaScript, all working JavaScript code is also TypeScript code. However, TypeScript tooling can help detect ...
Read more >connect gogle analytics with my next js typescript application
Help Center · Community ... connect gogle analytics with my next js typescript application ... Work with Tag Manager.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As a workaround I added this code in a Types.ts file
The original question was about
@analytics/google-tag-manager
. And although @GeoMarkou posted a really good workaround for@analytics/google-analytics
, those types are a little bit different.Here are the types for
@analytics/google-tag-manager
package: