Measurement Protocol - Core Setup
Overview » Core Setup » Validate Loop » MP Fun!
We’ll be setting up a new project, with billing from the Google Cloud side, then bolting Firebase in, and three apps will be generated - web, android, and iOS (it’s an ankle-tap as you’ll see later)
1. Turn it all on
Head to the google cloud console (console.cloud.google.com), and set yourself up a project. Mine is Errant Blueberry
.
Once you’re done there, head to the Firebase console (console.firebase.google.com) and convert that to a Firebase project.
When it asks, yes, yes you do want Google Analytics for this project. For this playaround purpose, I’ve created a new account.. and lastly configure GA.
For 95% of users the defaults are probably buuuut I would prefer less access so I’m only letting anon data for benchmarking to move across.
2. Generate ‘apps’ (data streams), config, and service keys
Righto. So in the Firebase console, generate three apps. For each app, get the Firebase App ID. For the web
app also grab the config pack. We will use this for the loop test in a bit, and we want the Measurement ID as well anyway.
Okay. Now we have to go to the analytics console so visit analytics.google.com and crack open the Admin view.
From there, under Property Settings > Data collection and modification head to Data streams. For each of your Android, iOS, and Web streams, you will need to generate a Measurement Protocol API secret. Note that these are linked to that particular stream so keep track of what belongs to what.
![arrows highlighting the admin icon and the data stream option](/assets/images/google_analytics_where_to_go.jpg “admin cog took me longer than I like to admit to find one time : | ”) |
⚠️ One HUGE gotcha, there seems to be a width bug so don’t do what I did and copy the text manually.. you could lose a few characters. Make sure you can see the copy icon.
Fiiiinally, in admin, look up your property details and get the property ID. You don’t need this, but we’re impatient and will use this in a second because who’s got time to wait?
All up you should have something like this, for Errant Blueberry (458451778):
app | firebase appID | gtag ID | MP API Secret1 |
---|---|---|---|
web | 1:517598319945:web:ed1a0479f89ed18962b698 | G-6Y3DPC68XD | pWumcEQ6QNiz1uwyf9Wn6w |
iOS | 1:517598319945:ios:1f478ed2c562d26c62b698 | - | M731bG3zTiOCEnyuC4s1Sg |
android | 1:517598319945:android:8a6fb54383a785c962b698 | - | Qdk40xCuRK-u5PQiWb4vqQ |
If it wasn’t obvious, the AppID contains an identifier for the project (I think), the platform type and then some kind of UUID-like.
3. Bigquery link
Almost done with config! Back to the firebase console and the project’s settings, you want to manage Integration. Since we made our apps beforehand it should have 3 of 3 exporting (but make sure).
You’ll also notice if you’ve not got billing, Streaming won’t be an option. It’s not critical but I would Strongly Suggest for the prototyping phase (for the scale I’m working at I’m still in the free tier). Waiting an entire day to do some checks is just unmitigated pain.
Finally, if you’ve just set this up you will notice that the dataset is not created. Let’s fix that.
Originally I waited overnight for the dataset to be created as regular batch operation.. but you can just do it yourself now, if you know the dataset name it’s looking for which is.. analytics_{propertyID}
2
So head to the bigquery warehouse for your project, and well, make that dataset. You’ll know it’s working correctly when you see a new tabled called events_intraday_
appear, and back in the firebase console it’ll show that dataset linked across.
❗If you aren’t set up for streaming you won’t see this! You will need to wait aaages and there’s no reason for this shortcut.
Phew! Okay, Time to move to Part 2, we’ve got all our config sorted.
Overview » Core Setup » Validate Loop » MP Fun!
-
yes, these are all revoked 😂 ↩
-
Was quite chuffed to work that out for this tutorial. The hint was from reading https://firebase.google.com/docs/projects/bigquery-export?product=analytics#change-dataset-location ↩