In this video, Iโll show you how to easily send refund information into Google Analytics 4 using the Measurement Protocol.
Iโll also show you our new form which streamlines the process of inputting refund data and submitting it to Google Analytics 4.
๐ Links:
GA4 Refunder: https://measureschool.com/refunder
GA4 Event Builder: https://ga-dev-tools.google/ga4/event-builder/
GA4 Measurement Protocol: https://developers.google.com/analytics/devguides/collection/protocol/ga4
๐๐ Courses and Resources โฌโฌ
Join our premium membership for exclusive content ๐ฆธโโ๏ธ๐ฆธโโ๏ธ https://bit.ly/measuremasters
GTM, GA4, and LS FREE Courses & Resources ๐ธ https://bit.ly/measureschool-courses
Need Personalized Help? Contact Us ๐ https://bit.ly/measureschool-services
๐ FOLLOW US ๐
LinkedIn: https://www.linkedin.com/company/measureschool/
Twitter: https://twitter.com/measureschool
Instagram: https://www.instagram.com/measure.school/
Facebook: https://www.facebook.com/measureschool
OUTLINE
00:00 - Intro
01:32 - Measurement Protocol Overview
02:23 - Event Builder Tool Overview
03:37 - Using the GA Refunder Tool for Processing Refunds
10:01 - Testing the GA4 Refunder Tool
10:42 - Outro
Hey there, and welcome back to
another video of MeasureSchool. My name is Julian, and today we want to
talk about how we can send refund information into Google Analytics
for via the measurement protocol. Now, the most common way to actually send
data into Google Analytics for is the tracking code that you have
installed on your website. That's how Google Analytics gets most of the information because the user is on the
website, gets all the information from the tracking codes and sends it when
the
event happens into Google Analytics for. But there are instances where
the tracking code is not useful. You because the user is actually not on
the website, such as refunds, for example. If you think about it, refunds happen after the user has purchased, and
therefore, they might not even be on the website itself, or they might
not be administering the refund. It might be a button that your customer service person clicks in the background
in order to issue the refund. So we need another mech
anism to send data into Google Analytics 4, and this is
where the measurement protocol comes in. Now, making it simple, the measurement
protocol is really just the API of Google Analytics 4, meaning that it's a standard
way to interface with Google Analytics for that other servers, other computers could
understand and send information into it. It's a protocol, so it has certain standards on how you need
to send that information in. So theoretically, you could connect any
other system to it, such
as a different server, a POS system,
or even your smartwatch. But in our case, it's really useful
to send also refund information in. I'll show you a way to do this today. So first of all, let's take a look at the measurement protocol inside
of Google Analytics 4. In the help section here, we find a little bit of information about
the measurement protocol. You can read through it in order to
understand it a little bit better. Here we see the architecture, and what we actually want to do here is
to send data
from a server with a certain payload to the collection endpoint, which will then
transfer that information to the Google Analytics UI if you have
BigQuery installed that as well. Now, it's important to understand that
there are certain standards that need to be met in order to send data to Google
Analytics 4 via measurement protocol. First of all, the GA4 measurement protocol nowadays is in authenticated endpoint, so
you need a secret key that only you know in order to send that da
ta in and then
Google Analytics 4 will accept it. The second point is that we have a POS request that we need to send in a certain
format with certain parameters in order for this to be accepted and then
processed by Google Analytics 4. In order to see this in action,
you can actually try it out. There's a little tool that has been built
by the Google team called the Event Builder, and this is available
under the gadef tools. Google, and you can
try it out right there. It's a simple form with al
l the data
that is needed in order to send a hit in. We need the API see through, the
measurement ID, the client ID, and some other information as well as obviously the
event name and then a few parameters inside of our hit as well, such as the
transaction ID, the value, and so on. Then you have this little tool down here. You can validate the hit. I think I need to still add some
information like the transaction ID. Let me see. Let's just put in some information
here and validate the hit. One m
ore thing, the currency
is very important as well. And then we can actually send this all over to Google Analytics From here, we can
also see the payload that would be sent. And this is the information how it needs
to be encoded inside of the POST request that you then send over
to Google Analytics for. Now, all in all, if you look at this, not
very user friendly, especially if you are not the one who is filling this out,
but your customer service staff. So we thought of a solution here that wou
ld be versatile and
shows the proof of concept. So we have built a integration with Google Forms called the GA4 Refunder, and you
can get your copy at measureschool. Com/refunder And it's a simple form, a
Google form that lives in your Google Drive, where you can fill out this
information and it's actually a little bit more explained, and we leave out some
parameters that might not be needed. So to show you how this works,
we need a GA for measurement ID. That's something you can find your admin
section of your Google Analytics account. We go here to data streams, and then
we have here our measurement ID. So let's copy that, put it in here. Then we need the measurement
protocol API secrets. That's actually in the
same menu right here. If you just scroll down, you find
the measurement protocol API secrets. You can create a new secret. It's called the GA4 Refunder. And that's a key that you should keep
private because otherwise, other people could send data into your
Google Analytics 4 a
ccount. And then it gets a little bit tricky
because you need to We have all the information about the transaction
that you're trying to refund. So for that, we have gone into Google Analytics 4 and created a Exploration
Report because there's no standard report that shows you that
information right away. With that report, we can show our
purchases that happened over a certain time period and the transaction
ID and the purchase revenue. If you want to rebuild this one, you can simply build a fre
e form report and add
the rows transaction ID and really just the values, purchase, revenue, text amount
in there and you will get the same report. With that, we have almost
all the information. First of all, the transaction ID,
let's copy that and put that in here. Then we have the transaction value itself. That would be $700. We need to have the currency. Let's put a USD right here. Then we need the client ID. How do we get the client ID? Well, we actually need to right click on the row here a
nd then
we can see View User. That will open up a new user Explorer
report with our client ID right here. Now, this might seem a little bit weird client ID, but that's just because
we have a server integration going. So don't mind it. If you have any spaces in here,
you need to also get rid of them. That's just because of the copying. And then that should be ready to go. Now, why do you need that exact client ID? It's simply because if you put in a random client ID, which would be also possible,
Google Analytics will send the data, it also will validate it, but it won't enter
into your UI and not be recorded because it will be filtered out by
the processing engine of GA4. That's unfortunate because you always need to have the exact client ID
that created the transaction. Be aware of that. We have that now in here
and the currency code. Then you can do partial refunds as well, where you could only refund
maybe one item or two items. If you wanted to do that, you click on yes here, and t
hen the next page will lead you
to the first item that you would need to describe in terms of the
item ID, quantity, and price. We can add up to four items as well. I won't do this for now. Let's just go back here and click on no,
and then we'll get to the last screen which shows us to finish
this with the submit button. We'll do this, and it's now sent
to our GA for measurement protocol. Now, unfortunately, Google Analytics
won't show us this right away. You can build a report here that will
sh
ow you the refunds that came in. This is only the refund
events that came in. We have here the values refund and refund
amount and as a rose transaction ID. If you wanted to rebuild this, you You would see this information
right here after 48 hours. It takes up to 48 hours in order to
see that information, unfortunately. I can't show you this live right now. The only thing that I can really show you
is, sometimes, I hope it works this time, let's go over to the
real-time reporting here. You woul
d be able to see if there
was an event that just happened. Down here, when we go to event count by event name, we have here
all of our different events. Unfortunately, we don't have our refund event Normally it should actually show up
here, but sometimes this apparently gets blocked because of
batching issues and so on. So I wouldn't discount it completely
that this didn't go through. We actually have another method of seeing if the data has been sent, and
I'll show you this in a second. So I ho
pe this GA4 Refunder is a cool tool
for you maybe to use in your customer service and be able to utilize
this to send in refunds. It's just our suggestion of doing so. If you want to get a hold of
this, go over to measureschool. Com/refunder And then you'll
be able to copy this document. And there are some set up steps involved. So just to go through them really
quickly, you need to copy this event. This will copy not only the form, but also the attached app script, which sends
the data to the m
easurement protocol. So let's make a copy here. This will be copied directly into your Google Drive account, so you have
full ownership of it later on. And then once you are in here, you need
to, first of all, initialize the whole thing by clicking on the menu
and going to script editor. And here's all the app script that we have written in order to make our
measurement protocol hit work. And then you just simply
click on run here. Make sure that it's set
to trigger on first run. And this app sc
ript actually sends
data to Google Analytics for. From your Google Drive account
to Google Analytics for. And therefore there are some permissions involved that you want to review and
then accept in order to make this work. I'm going to log in here, look
through the permissions and allow. And that will then set up the trigger for us to be working with when somebody adds
something to our measurement protocol hit. So then you can close this window again. And this is now fully set up. You can obvio
usly change around the name if you wanted to get rid of
the setup steps right here. And in the end, you can send this off to your customer service staff by
going into the send form link. And this is the actual link that would be
used later on by the staff to fill out. They have this right here. And what you can also do if you don't want
to go through the steps all the to have the GA4 measurement ID or the measurement
protocol always needing to be looked up and filled out, you can actually build
a
prefilled link by going into this option right here, filling this out
with the appropriate information. So just for For demonstration sake, I'm just going to go and
take this information. And at the end here, we'll go get link. And here we have the link. And once the user puts that stuff in, it's already prefilled, so you don't
have to do it again as the end user. That's just a little tip on my side. Now, I wanted to just briefly show you also how you can see the information
that gets sent fro
m this form. Let's come up with a hypothetical
hit that would be sent. I'm just going to do a bogus client ID and transaction ID and value in here,
currency, and let's send this off. And now you would be able to go back into the editor and go to this
menu item here, Executions. And here you see the process
refund that just fired. And this is all the
information that would be sent. So you can also double check if the
information was actually sent through this execution log, which is
helped by App
script as well. So again, if you want to get a hold of this GA4 Refunder, go
over to measureschool. Com/refunder. Now, I hope you find this useful. It makes your life a little bit easier. This is by no means the end-all solution,
but just the ones that we propose. If you want to see more videos about Google Analytics 4, we have a whole
playlist here that you can check out. My name is Julian.
Till next time.
Comments
Check out our FREE Resources๐https://bit.ly/yt-exclusive-offer
How to make a copy? I confirmed email, send request to get access, receive an answer, but still have no permissions to copy document.