-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Send search analytics for Google Analytics 4 #3169
Comments
Thanks for reporting! The problem with site search tracking in GA 4 is that it's very complicated to set up, which is why it's not considered to be in-scope. This is also mentioned in the documentation in "how to measure site search usage". |
@squidfunk I understand that it's a little tougher to set up on the Google Analytics side, but I think it would still be nice if mkdocs-material fired a custom event for search so that the data is somehow available. I suppose it can be hacked around with custom javascript, but would be a pretty common use case. |
If you would like to work on this, we can integrate it. Unfortunately, I currently don't have the bandwidth to do so. We would need a snippet to send the data, similar to the following code: mkdocs-material/src/partials/integrations/analytics/google.html Lines 73 to 81 in b405149
... and documentation, which explains how to configure Google Analytics to pick up the query. The code snippet has to go into the same file, but into the GA4 section. If you can provide both in a PR, I'm happy to merge it. |
@squidfunk created #3184 |
Contribution guidelines
I want to suggest an idea and checked that ...
Description
It'd be great if mkdocs-material would send search queries to GA4.
#1658 was the previous implementation of this for Universal Analytics (UA-*)
Use Cases
This would help to understand how documentation is being used and improve the ranking of pages.
Screenshots / Mockups
No response
The text was updated successfully, but these errors were encountered: