johannschopplich / nuxt-gtag

🔸 Google Analytics & Ads integration made easy
https://developers.google.com/tag-platform/gtagjs
MIT License
298 stars 9 forks source link

Multiple tracking IDs #30

Closed reslear closed 7 months ago

reslear commented 10 months ago

Describe the feature

multiple trackingIds in config:

id: string | string[] - (id) => [].contact(id).foreach((_id) => gtag('config', _id))

and add sugar method for runtime - configureTrack.

https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-google-gtag/src/gatsby-ssr.js#L65

also maybe need add sugar method to get clientId and prevent duplications https://www.analyticsmania.com/post/get-google-analytics-client-id/

Additional information

Final checks

johannschopplich commented 10 months ago

Good idea. Should be pretty straight forward to implement. PR welcome! 🙂

reslear commented 10 months ago

also good implementation https://github.com/facebook/docusaurus/blob/7dcad0c6322c87131f9f39cbc4e765b0e1119fe8/packages/docusaurus-plugin-google-gtag/src/index.ts

vietanhbui commented 10 months ago

+1