You would think changing a Data Stream’s name in Google Analytics 4 would be simple right?! Wrong! This post will show you how do it using the Admin API – the only way to currently do it.
Update 30th May 2022:
So it seems Google have finally rolled out an edit button to adjust the Data Stream name and URL! It took a while, but now you don’t need to use the API workaround method detailed in this post (although you could if you wanted to).
You might think that changing your Data Stream name in Google Analytics 4 (GA4) would be simple, but it is not. You might also think that this sort of thing would be obvious to add as a feature after now 18 months since it officially came out of beta, but it isn’t apparently.
The long and short of it is that you cannot change a Data Stream name once you set one up in the interface. Well you can, just not from within the interface itself, you need to you the Google Analytics Admin API. Which is itself in early access and subject to change.
As of the time of writing this post, the method detailed below works.
Checking the Data Stream
When creating a web Data Stream from withing the GA4 UI, you only have have to add two things; the website’s domain and a name.
The Data Stream name is what you will be using in the reporting and analysis, so this should be something you will understand and/or recognise across the business.
For example, my two Data Stream names are:
Let’s say you (or someone else) misspelled the name of the Data Stream when setting it up. Or even if the name needs to be updated when adding in a few other Data Streams so that you can tell them apart. There is no edit button in the GA4 UI to go in and edit or update this. The only option you have is to delete the whole Data Stream – which is not ideal.
Using the API
The only way to update the Data Stream name is to use the Admin API v1.0 (early preview). Yes, really. But, it’s actually not that hard to use – you don’t have to know how to call APIs, be a developer or anything like that. In the developer documentation, Google provides a way to ‘try’ the API in a panel on the right hand side of the screen. And it is this feature that we can use to update the Data Stream names.
To update the Data Stream name, go to https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/patch and add to the “name” field:
where PROPERTY_ID and DATA_STREAM_ID is replaced with the Property and Data Stream IDs that you intend to rename. And then add to the “updateMask” field:
And finally, add the name you want to update the Data Stream name to in the “Request body” section (the maximin Data Stream name length is 255 characters).
So it would look something like:
Once you’re happy, click the EXECUTE button below and go through the steps to authenticate your Google account if this is your first time using the API. After a few seconds, you can refresh your GA4 admin page to then see the new name being used!
So you can go from a wrong name…
…to the correct name within seconds.
Note: There is currently no way to update the domain via this method, sorry.