[MUSIC PLAYING]
KRISTA SEIDEN: Hey, everyone.
I'm Krista Seiden.
And I'm so excited to be with you here today
to talk with Brian Stark, a Product Manager on Google
Analytics about the measurement protocol in Google Analytics 4.
Now, this is so exciting to me because the measurement
protocol was one of the most loved features in Universal
Analytics.
And it's finally here for Google Analytics 4.
So with that, Brian, I'm going to hand it over to you
to tell us all about it.
BRIAN STARK: Thank you, Krista.
I'm really excited to talk to you.
And I think the measurement protocol
is a super exciting feature in the new Google Analytics.
So as Krista mentioned, my name is Brian Stark.
I'm a Product Manager working for GA.
Allow me to take you to some slides
and show you the measurement protocol.
So you might wonder, what is the measurement protocol?
Well, the measurement protocol is a communications format
that lets you send your own event data to Google Analytics
over in HTTP post request.
It's typically used to send data collected
from an offline system like a CRM,
or a credit card validation system.
It lets you send data that's asynchronous.
So it happens after the event that you
collect on the web or app SDK.
The measurement protocol augments
the data you're collecting from the web or app.
It's not intended to replace it.
You still need to use the SDK's to get
a full picture of your users.
And for GA4, we introduced this new feature.
It's an API key.
It requires you to sign all the data that comes
to the measurement protocol.
And what this means is you can ensure
that the data that you're sending
is actually coming from you and not from some spammer.
KRISTA SEIDEN: Now, Brian, that last piece
that you just mentioned about this API key, that
is super exciting, because one of the things that didn't
necessarily work that great with the measurement
protocol in Universal Analytics is that you were
vulnerable to spam or to anyone else sending you data
through the measurement protocol.
So I'm so excited to hear about this new enhancement.
And I know this is going to be really great for our users.
BRIAN STARK: That's right.
Yeah, we're really excited about this, too.
We think it's a big step forward for the GA4 measurement
protocol versus what was available in Universal
Analytics.
So let me show you how it works.
This is the event builder for the measurement protocol.
We provide it so you can understand
how to create events.
The first thing you'll notice is at the top of the event
builder, there is this address here,
which is basically the URL which the data must be sent to.
It has the URL name, www.GoogleAnalytics.com,
and then additional information you have to send--
the address and also the measurement ID,
what you see here, and the API secret.
Let me show you where to get those.
They're both available in the Admin section
of Google Analytics.
So if you go to the Admin section,
you'll click on your data stream, which can be
either an app or a web stream.
And here I have a web stream.
I'll click on that, and I'll see this details panel.
In the upper right, you'll see the measurement ID.
You can go ahead and copy that and paste it
into the event builder for the measurement protocol.
And then down here at the bottom,
you see the measurement protocol API secret.
If I go ahead and click in there,
I'll be able to create an API secret
or take one that I've already built. Here
I have one that can go and copy and paste into the event
folder.
So going back, I now am able to build a measurement protocol.
I can enter my API secret as well as the measurement ID.
On top of that, I can enter a client ID,
which is basically a user ID.
This will be either available from the web SDK
or you can get it from the big query export.
You can also supply your own user ID, just called user ID
here, as well as a timestamp.
The time stamp can be up to three days in the past
and is supplied in microseconds.
Finally, you can specify both the event name
and any event parameters you'd like to specify.
Here I selected my name, Brian, my height, 73,
as additional parameters I'd like to send with the event.
And then I set some user properties.
In this case, I picked my [INAUDIBLE] equal to blue.
So once I've built the event, the event builder
will show you up here.
And this is the exact format you need
to send to Google Analytics.
And here I can go and go ahead and press and send
a couple of events over to GA.
And finally, you would go to the real-time report in GA
to ensure that the data was formatted correctly and showing
up.
So if I go to this screen, the real-time report,
I'll see down here the event count by event name.
And sure enough, those events I just sent over
are now available in GA.
I can even click on the event and see the event parameters.
So there you see my height.
73 has been passed over, as well as my name, Brian.
And that's it.
You've got a measurement protocol event
that you generated and sent to Google Analytics
to get your own data into the system.
KRISTA SEIDEN: Thank you so much for walking us
through that, Brian.
It is so exciting to see how the measurement protocol works
in Google Analytics 4.
And I hope you guys can go ahead and start trying this out
today.