-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(gatsby-plugin-google-analytics): add custom event helper #17612
feat(gatsby-plugin-google-analytics): add custom event helper #17612
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this can come in handy for lots of users. A follow up could be to do a High Order component so we can wrap any component with a custom tracking event.
I wonder if we want to add an optional hitCallback
parameter?
Co-Authored-By: Ward Peeters <ward@coding-tech.com>
Co-Authored-By: Ward Peeters <ward@coding-tech.com>
Co-Authored-By: Ward Peeters <ward@coding-tech.com>
hitCallback would be useful! Any chance of getting this section pushed (so I can use it in a project I am working on) and then I can come back to this? |
Removed spaces
Completely missed that line comment! Sorted now. |
Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to wrap window.ga
we should consider incorporating the remaining event
options that Google Analytics supports like setting transport: beacon
and nonInteraction: true
as well: https://developers.google.com/analytics/devguides/collection/analyticsjs/events
Co-Authored-By: Corey Ward <corey.atx@gmail.com>
Co-Authored-By: Ward Peeters <ward@coding-tech.com>
Co-Authored-By: Michael <184316+muescha@users.noreply.github.com>
Co-Authored-By: Michael <184316+muescha@users.noreply.github.com>
Co-Authored-By: Michael <184316+muescha@users.noreply.github.com>
Co-Authored-By: Michael <184316+muescha@users.noreply.github.com>
Hey, Working with packages inside massive repos is not something I am used to dealing with. How do I get this to a point that it can be merged? Thanks |
I'll give it a final review :) |
@wardpeet What are your thoughts? Do I need to merge the upstream before it can be added? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is getting pretty close! Some small changes to make tests pass and fix docs
Co-Authored-By: Ward Peeters <ward@coding-tech.com>
Co-Authored-By: Ward Peeters <ward@coding-tech.com>
Co-Authored-By: Ward Peeters <ward@coding-tech.com>
Co-Authored-By: Ward Peeters <ward@coding-tech.com>
cc @wardpeet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robmarshall thanks for creating this helper! Sorry, it took so long to get this merged.
Thank you! Let's ship it!
Amazing! Thanks @wardpeet, looked over your cleanups, so much nicer! Thanks for the help :) |
# By Sidhartha Chatterjee (6) and others # Via Ward Peeters * master: (95 commits) chore(release): Publish fix(gatsby): Use crossorigin for link in linkPrefetch strategy (gatsbyjs#17581) chore(www): Referrer policy (gatsbyjs#18621) feat(gatsby-source-shopify): support multi currency (gatsbyjs#19454) feat(gatsby-plugin-google-analytics): add custom event helper (gatsbyjs#17612) chore(docs): Add documentation for tailwindcss support (gatsbyjs#17747) Grammar fix (gatsbyjs#19473) Update sites.yml (gatsbyjs#19475) test(e2e-tests): add regression test for resolution conflicts… (gatsbyjs#19476) chore(release): Publish chore(docs): link to gatsby-plugin-catch-links in gatsby link… (gatsbyjs#19424) chore(gatsby): remove array.prototype.flatmap (gatsbyjs#19472) fix(gatsby): Re-use plugin resolution logic for theme dir resolution (gatsbyjs#19470) chore: Update stale action (gatsbyjs#19471) chore(showcase): add Kosmos to the showcase (gatsbyjs#19455) chore(showcase): Add Akshay Thakur's Portfolio (gatsbyjs#19370) chore(docs): Add note about file extensions (gatsbyjs#19464) chore(showcase): Add Quema Labs (gatsbyjs#19374) Update starters.yml (gatsbyjs#19375) fix(gatsby-transformer-remark): Check key before trying to get cache (gatsbyjs#19288) ...
A custom event tracker for gatsby-plugin-google-analytics.
The user can import function "customTrackingEvent" from the plugin to call a tracking event on dynamic events or events that do not involve a new page loading.
An example would be tracking what filters have been used to dynamically sort items on a page. On each press of the sorting button, the event would fire, and then the items would be sorted. Allowing the website admin to see which combination of events are more used.
The user can provide the following values:
In response to this issue: #17603
I have added a basic test case, wasn't sure how else to test this. I have also added a short snippet for the documentation.
Let me know thoughts/improvements.
Thanks!