Skip to content
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

"Was this page helpful" does not work with Google Analytics 4 properties #3170

Closed
4 of 5 tasks
garrettheel opened this issue Nov 3, 2021 · 7 comments
Closed
4 of 5 tasks
Labels
change request Issue requests a new feature or improvement resolved Issue is resolved, yet unreleased if open

Comments

@garrettheel
Copy link
Contributor

garrettheel commented Nov 3, 2021

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

When using GA4 analytics properties, the "Was this page helpful?" feature does not work. Reading the code, it looks like this is currently only implemented for Universal Analytics.

Also mentioned in #3011

Expected behaviour

I expect to see the widget at the footer of the page.

Actual behaviour

The div is hidden, since there is no implementation for this analytics provider.

Steps to reproduce

  1. Use a GA4 analytics provider and switch on the feedback feature

  2. Observe that there is no "was this page helpful" widget displayed

Package versions

  • Material: 7.3.6+insiders.3.1.5

Configuration

# ...
extra:
  analytics:
    provider: google
    property: G-...
    feedback:
      title: Was this page helpful?
      # ... 

System information

N/A

@squidfunk squidfunk added the change request Issue requests a new feature or improvement label Nov 3, 2021
@squidfunk
Copy link
Owner

squidfunk commented Nov 7, 2021

I've added the sending of the feedback event data for GA4 in bfdd5c670, but I yet have to find out how to build a sensible custom report from this. We need to add a guide to the documentation so users don't get lost.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Nov 7, 2021
@squidfunk
Copy link
Owner

squidfunk commented Nov 8, 2021

I had to reissue the latest release (my fault), so this has been released as part of 7.3.6+insiders-3.2.2. I'll let this open until we find out how to build a sensible custom report from this.

@squidfunk
Copy link
Owner

@garrettheel did you manage to create a custom report in GA4?

@garrettheel
Copy link
Contributor Author

@garrettheel did you manage to create a custom report in GA4?

Not yet, still contending with the confusing UI and lag in data becoming available. I'll keep trying and report back

@garrettheel
Copy link
Contributor Author

@squidfunk I made some progress here. It's definitely a bit of effort to get this set up, and I think the large initial delay is likely to confuse a lot of folks. Nevertheless, here are the steps I took:

  1. Create a "Custom metric"

    • Go to the "Configure" tab on the left hand menu, then "Custom Definitions"
    • Click "Create custom metrics" and set one up like so:
    Screen Shot 2021-11-11 at 1 43 37 PM
  2. Create a new "Exploration"

    • Go to the "Explore" tab on the left hand menu, then hit the big plus sign to create a new blank exploration
    • For "Variables"
      • Under "Dimensions", add both "Event name" and "Page location"
      • Under "Metrics", add both "Event count" and our custom metric "Page Helpful"
    • For "Tab Settings"
      • Under "Rows", drag in "Page location"
      • Under "Values", drag in both "Event count" and "Page Helpful"
      • Under "Filters", create a new filter for Event name / exactly matches / feedback

Note that data appears to be delayed by ~24 hours, so I had to wait a day to come back and see data show up. If you don't see data, also ensure that the date range at the top left side is "last 7 days" or similar.

One other thing: it's difficult to sort unhelpful pages because the feedback is sent with data = 0, so a sum of that field is not very helpful. I also can't find a way to create a custom metric that is a ratio (i.e sum(data) / event_count). I think it's probably worth changing the default thumbs down example to send -1 instead of 0 so that you can sort descending on Page Helpful and see something useful

@squidfunk
Copy link
Owner

Would you care for writing a guide for the documentation as part of a PR?

@squidfunk
Copy link
Owner

I'm closing this issue for now, as the problem reported in the OP is fixed and we have all the information here on how to set it up. If somebody wants to write a guide for this, a PR is very much appreciated. I'm not a user of GA4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change request Issue requests a new feature or improvement resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants