Ok I’m kinda bummed: why doesn’t Google just add a field to Google Analytics that gives you the account ID, instead of telling people who want to track Google sites to extract the account ID from the javascript code…
Well I’m here to make it easier for you people. Paste the code that Google gave you into the textarea below, and click this button:
Now Google Analytics team, if you’re reading this, this isn’t hard, here’s the code, feel free to use it:
<script type="text/javascript" charset="utf-8">
function get_UA() {
txt = document.getElementById('scripttag').value;
var matches = txt.match(/(UA-[\d-]+)/);
if (matches[1]) {
alert(matches[1]);
}
}
</script>
<textarea name="script" cols="40" id="scripttag" rows="10"></textarea>
<button onclick="javascript:get_UA();">get account id</button>[/code]
That's a whole lot easier than telling people how to extract their UA code, isn't it?



On my Google Analytics, the UA is right next to the name of each site before I view the reports. I don’t know what happens if you only have one site, but I don’t think this is an issue for people with multiple sites being tracked, at least…
True, was pointed out on Twitter as well, but Google is telling people to extract it from the code, that’s just plain lame to me…
Joost, has you script anything to do with the warning at the bottom of this page?
Warning: fsockopen() [function.fsockopen]: unable to connect to tr.im:80 (Connection timed out) in /nfs/c01/h04/mnt/43978/domains/yoast.com/html/wp-includes/class-snoopy.php on line 1142Nope, that’s tweetbacks causing issues…
Instead of pasting in the code, why not ask for a URL and pull it from the site? That would be waaaay easier and quicker. Not that I don’t appreciate what you have done here ;)
Not quite sure I get what you mean there… The code isn’t on the site yet, so no way to get it from there, I guess? :)
Isnt that one available from the profile overview nowadays?
Sorry Joost,
I misunderstood. I thought you the code was on site already and you needed to get the ID for some reason.
uh guys it’s really easy to get ur account id
in you analytics dashboard just click on analytics settings and there is your account ID
why not a simple line to paste in the url during the visit? :)
javascript:prompt(“your account”, pageTracker._getAccount());void(0);
I did what you said ( copy and paste and I still don’t know where my ua code or account or what ever is. Please help me I have three web sites and none of them have it. asklynne.com, petryandprose.com and writersandartists.com Thank you for any help you can give me. Lynne
I did what you said ( copy and paste and I still don’t know where my ua code or account or what ever is. Please help me I have three web sites and none of them have it. asklynne.com, poetryandprose.com and writersandartists.com Thank you for any help you can give me. Lynne
Hey Lynne, try this video.
What’s ironic is that the analytical ID is directly next to your website in your profile, but
it doesn’t indicate that its your ID. THank for sharing and creating this!! After I posted my code,
the ID matched exactly on my Analytics profile.