AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

3.6K members online now
3.6K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

Is there a pattern to the Tracking Id that could be used for validation?

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We're looking at the possibility of adding the option to turn on Google Analytics in our web application that we sell to our customers (who host it themselves or in our cloud platform).  Our customers would need to get their own Google Analytics account and enter their Tracking Id into the Admin section of their web application if they choose to enable the Googly Analytics option in their web application.  We would take that Tracking ID and dynamically insert it into the JavaScript block we'd add to our product from Google Analytics.


My question: Is there a pattern to the Tracking ID's we could use to validate that the user has entered a well formed Tracking ID? Will it always be UA-########-# where # is a digit from 0-9?

1 Expert replyverified_user

Is there a pattern to the Tracking Id that could be used for validation?

Top Contributor
# 2
Top Contributor

Hey Lee, 


Short answer is yes, you can create a place inside of your platform for users to place their analytics code. Countless companies do this and each implements its different. Personally I would recommend that you include code to make sure the UA ID is properly inserted. Also keep in mind there are many variations to the UA ID such as display remarketing, user ID, etc that require code modification so you may want to include such options. 


The best place to get started is probably here: 


Hope this helps! 



Joshua, Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’