Replies: 3 comments 4 replies
-
@koji-koji I love this proposal! I implemented the Is there any momentum to work on adding these features now? |
Beta Was this translation helpful? Give feedback.
-
Sorry, the document link was not broken. I'm using the Brave browser, but it opened without issues in Chrome. However, the other issues still remain. |
Beta Was this translation helpful? Give feedback.
-
Great proposal! Just wondering before changes can be made, what will be the most appropriate way to pass |
Beta Was this translation helpful? Give feedback.
-
Goals
config
function in gtag.js cannot be set with the Google Analytics component in Third-Party Librariessend_page_view
tofalse
, which is available in gtag.js.send_page_view
option, but it is unclear how to configure it, so this needs to be addressed.Non-Goals
Background
Currently, the Google Analytics component in Next.js' Third-Party Library does not provide the functionality to set the
send_page_view
option tofalse
or to configure the default parameters available in gtag.js'sconfig
function. This limitation can cause issues when users want to manually send pageview events but are unable to disable the default pageview tracking, potentially leading to duplicate data.The Next.js documentation recommends disabling the default pageview measurement when manually sending pageview events. However, the current Google Analytics component does not offer a way to set
send_page_view
tofalse
, resulting in a discrepancy between the documentation and the available functionality.Additionally, the link in the documentation appears to be broken, makingit unclear for users on how to proceed.In practice, the Google Analytics component currently only passes the
config
string and thegaId
to thegtag
function as arguments, without the option to include additional parameters required for more advanced configurations.To disable
send_page_view
or configure default parameters, it is necessary to pass an additional third argument to thegtag
function:Without the ability to pass this third argument, the Google Analytics component may not function adequately for certain use cases, such as when users need to prevent the default pageview event from being sent or apply specific configuration options. Therefore, it is desirable to allow configurations equivalent to those possible with gtag.js's
config
function to ensure that the component is flexible enough to meet these needs.Proposal
To implement this feature, I propose adding a new argument called
gaOptions
to theGoogleAnalytics
component in thepackages/third-parties/src/google/ga.tsx
file. This argument would allow users to pass custom configurations directly as the third parameter to thegtag
function'sconfig
call.Specifically, the code would be modified as follows:
As for the documentation, I suggest the following adjustments:
send_page_view
tofalse
or configure common parameters, you can do so by adding thegaOptions
argument."Change Broken Link: Replace the outdated or broken link with the correct reference to Google Tag Platform Documentation.Example:
By updating the documentation in this way, users will have a clearer understanding of how to use the
gaOptions
argument to customize their Google Analytics setup.I am eager to contribute to the implementation of this feature!
Beta Was this translation helpful? Give feedback.
All reactions