Jason Vertucio

You know me! ™

Daily Regex: Google Analytics Tracking IDs

This won’t be a daily thing. But I just put together a quick Google Analytics Tracking ID for one of the apps I’m putting together. You know, to make sure you enter the correct one. It’s super easy.


function isGoogleAnalyticsTrackingId(id) {
var pattern = /^UA-\d{2,}-\d{1,2}$/;
return pattern.test(id);
};

Now, I’m sure you, astute readers, will be able to pick apart any errors in this. So, have at it!

Your Comment

Your email address will not be published. Required fields are marked *