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

Heatmap support #68

Open
marandaneto opened this issue Jan 2, 2024 · 2 comments
Open

Heatmap support #68

marandaneto opened this issue Jan 2, 2024 · 2 comments
Labels
enhancement New feature or request Heatmap

Comments

@marandaneto
Copy link
Member

marandaneto commented Jan 2, 2024

Description

https://posthog.com/docs/toolbar/heatmaps

We'd need to create a Widget wrapper that tracks and captures every interaction such as clicks, etc.

You can manually do this though, by capturing events manually.

@marandaneto marandaneto added enhancement New feature or request Heatmap labels Jan 2, 2024
@th8m0z
Copy link

th8m0z commented Jan 7, 2024

I love Posthog and this feature would be such a gamechanger. Can you share more details on your ideas for the implementation? I'd love to contribute.

@marandaneto
Copy link
Member Author

marandaneto commented Jan 8, 2024

To capture events manually, you have to capture an event called $autocapture with the following properties:

                      ElevatedButton(
                        onPressed: () {
                          Posthog()
                              .capture(eventName: '\$autocapture', properties: {
                            '\$event_type': 'touch',
                            '\$touch_x': 100, // read the position 
                            '\$touch_y': 100, // read the position 
                          });
                        },
                        child: const Text("Capture touch event"),
                      ),

The goal would be to do that automatically instead of calling capture manually in every single widget.

The problem is that heatmaps is only available via the toolbar (Web only), so you'd not be able to see the heatmaps for Mobile yet anyway, this would be a feature request, Heatmaps for Mobile in general.

The suggested approach would be useful anyway since more events would be captured automatically instead of manually.

We can achieve that by doing something similar to https://github.com/ueman/sentry-dart-tools/blob/main/sentry_flutter_plus/lib/src/widgets/click_tracker.dart which is a widget wrapper that then can "intercept" every click.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Heatmap
Projects
None yet
Development

No branches or pull requests

2 participants