Skip to content

Commit c2474ef

Browse files
authored
chore: clarify the FAQ about programmatic access to results (#826)
1 parent 2cad3a0 commit c2474ef

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

docs/faq/data-metrics-analysis.mdx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,30 @@ After completing your experiment brief and defining your learning goals - attend
3636
---
3737

3838
## Is there a straightforward way to get the results from an experiment programmatically? Like a JSON object or something that I could convert into a dataframe?
39-
**Yes.** Results are available in bigquery and GCS, though what you see in Experimenter has been transformed a bit.
39+
**Yes.** Results are available in BigQuery and GCS, though what you see in Experimenter has been transformed a bit.
4040

41-
Daily, weekly and overall results are in this bucket as JSON (you may need to request permission to access this data):
41+
Daily, weekly and overall results are in GCS in [this bucket](https://console.cloud.google.com/storage/browser/mozanalysis/statistics) as JSON (you may need to request permission to access this data).
42+
The JSON files are named in the format `statistics_{slug_with_underscores}_[daily|weekly|overall].json`. Here are some examples:
4243
* https://storage.cloud.google.com/mozanalysis/statistics/statistics_device_migration_new_user_onboarding_pt_2_daily.json
43-
* https://console.cloud.google.com/storage/browser/_details/mozanalysis/statistics/statistics_device_migration_new_user_onboarding_pt_2_daily.json;tab=live_object?project=moz-fx-data-experiments
44+
* https://console.cloud.google.com/storage/browser/_details/mozanalysis/statistics/statistics_device_migration_new_user_onboarding_pt_2_daily.json
4445

4546
Example query:
47+
**Pre-requisites**
48+
```python -m pip install mozilla-jetstream```
4649

4750
```
4851
from jetstream.bigquery_client import BigQueryClient
49-
PROJECT_ID = 'moz-fx-data-experiments'
50-
DATASET_ID = 'mozanalysis'
52+
53+
# authenticate to bigquery
54+
from google.colab import auth
55+
56+
auth.authenticate_user()
57+
58+
PROJECT_ID = "moz-fx-data-experiments"
59+
DATASET_ID = "mozanalysis"
5160
client = BigQueryClient(PROJECT_ID, DATASET_ID)
52-
df = client.table_to_dataframe('statistics_<slug>_overall_1')
61+
slug_with_underscores = "device-migration-new-user-onboarding-pt-2".replace("-", "_")
62+
df = client.table_to_dataframe(f"statistics_{slug_with_underscores}_overall_1")
5363
```
5464

5565
If you already have `mozanalysis` set up, here's another example query:

0 commit comments

Comments
 (0)