You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: develop-docs/development-infrastructure/analytics.mdx
+28-14Lines changed: 28 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,6 @@ description: This guide steps you through instrumenting your code with Sentry's
4
4
sidebar_order: 90
5
5
---
6
6
7
-
8
7
## Big Query
9
8
10
9
[BigQuery](https://cloud.google.com/bigquery/) is a Google data warehouse that a lot of our data calls home. This includes all our analytics data and some (not all) production data that might be of interest when joins are necessary for answering richer, more complex questions. From sentry/getsentry, our data goes through [reload](https://github.com/getsentry/reload), our ETL for BigQuery.
@@ -103,6 +102,7 @@ analytics.record(
103
102
Run the tests that touch the endpoint to ensure everything is Gucci.
104
103
105
104
### Step 3:
105
+
106
106
By default, a new event type is aggregated and sent to Amplitude as long as there is a user_id sent along with the event. If you would like to send events unaggregated, refer to [our Amplitude aggregation docs](https://github.com/getsentry/etl/blob/master/documentation/amplitude_analytics.md)
107
107
108
108
## Route-Based Frontend Analytics
@@ -180,7 +180,7 @@ Example:
180
180
<RestartButton
181
181
analyticsEventName="Growth: Guided Tour Restart"
182
182
analyticsEventKey="growth.guided_tour_restart"
183
-
analyticsParams={{tour: 'issues'}}
183
+
analyticsParams={{tour: "issues"}}
184
184
/>
185
185
```
186
186
@@ -198,10 +198,10 @@ First, add the Typescript definition of the event to an analytics event file ins
"example_tutorial.viewed": null, // don't send to Amplitude
219
219
};
220
220
```
221
221
@@ -242,21 +242,23 @@ Our current naming convention for Reload events is `descriptor.action` e.g. what
242
242
243
243
### Testing your Analytics Event
244
244
245
+
It's important to test analytic events to ensure the data you are looking at is accurate. Any additional analytic event should be tested before merging to make sure that the events are firing correctly (with the correct values at the right times). A common issue we see when testing gets overlooked is events firing multiple times when they should only fire once.
246
+
245
247
When developing locally, analytics events will not be sent to Reload or Amplitude. To test to see if your event is sending as expected and with the correct data, you can set "DEBUG_ANALYTICS" to "1" in local storage on your browser. Then it will log the analytics event data to your console, whenever it would've sent an analytics event, allowing to check your analytics locally.
@@ -271,15 +273,15 @@ class ExampleComponent extends React.Component {
271
273
All you'll actually need is to import analytics from utils and call it wherever you need. Keep in mind the effect of React lifecycles on your data. In this case, we only want to send one event when the component mounts so we place it in `componentDidMount` .
@@ -288,6 +290,18 @@ class ExampleComponent extends React.Component {
288
290
}
289
291
```
290
292
293
+
After deploying your changes, you can open the Dev Tools in your browser and in the "Network" tab, search for the `event/` request. This will show the events being sent to Reload and Amplitude.
294
+
295
+
## Debugging
296
+
297
+
If your analytics aren't showing up after you added it, you can't find an event you expect to be there, or something else goes wrong, there are a few troubleshooting steps you can try:
298
+
299
+
- Follow the steps [above](https://docs.sentry.io/development-infrastructure/analytics/#testing-your-analytics-event) to confirm that your analytics event is sending correctly, with the correct parameters.
300
+
- Check Amplitude for blocked events: In Amplitude, go to the "Data" section in the sidebar. From there, navigate to "Events" and search for your event name. It will show up with status "Blocked" if blocked, which means events won't show up. Some events may be blocked in favor of automatic route or button analytics.
301
+
- For route analytics, confirm that the analytic event isn't being blocked with `useDisableRouteAnalytics`. Some components already had an analytic event so the route analytics were disabled.
302
+
- Check the types of the data you are sending. Arrays aren't recommended data types to send (they can be hard to query and produce some unexpected behavior). Try to remove those if you are using them.
303
+
- Remember there will always be some discrepency. Ad-blockers, for example, can block events from being sent. This could be a cause of why some numbers aren't adding up.
304
+
291
305
## Metrics
292
306
293
307
Track aggregrate stats with [Metrics](/backend/metrics/). For example, this can be used to track aggregate response codes for an endpoint.
0 commit comments