1👍
The Google Tag Measurement ID will be rendered plainly to html code and will be visible publicly when someone views the website source code. Hence, it doesn’t have to be a secret.
However, if you’re looking to use it across several places in your app or you have different ID for diffrent pages/use cases, it might be helpful to store it in a variable so you can use the variable easily and apply it without typos.
Source:stackexchange.com