Easily get your Google Analytics account ID
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?





by Jason Lengstorf on 23 January, 2009 at 00:00
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...
by Joost de Valk on 23 January, 2009 at 00:01
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...
by John Stevens on 23 January, 2009 at 00:02
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 1142by Joost de Valk on 23 January, 2009 at 00:03
Nope, that's tweetbacks causing issues...
by Mike Belasco on 23 January, 2009 at 00:04
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 ;)
by Joost de Valk on 23 January, 2009 at 00:06
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? :)
by Martijn on 23 January, 2009 at 00:34
Isnt that one available from the profile overview nowadays?
by Mike Belasco on 23 January, 2009 at 05:51
Sorry Joost,
I misunderstood. I thought you the code was on site already and you needed to get the ID for some reason.
Pingback: How to find Google Analytics account number | SeoblogR
Pingback: Cool Tool to Find Your Google Analytics ID | E-Commerce Optimization & Marketing
by umaxtu on 26 January, 2009 at 02:04
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
by Marco Cilia on 26 January, 2009 at 10:19
why not a simple line to paste in the url during the visit? :)
javascript:prompt("your account", pageTracker._getAccount());void(0);
Pingback: How to track conversions on WordPress contact forms - Part 2
Pingback: If You are Online You Want to be Found | Net-Biz101
Pingback: Did You Setup Google Analytics Correctly? | Mike McCready
by Lynne on 25 March, 2009 at 17:15
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
by Lynne on 25 March, 2009 at 17:16
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
by Joost de Valk on 25 March, 2009 at 21:09
Hey Lynne, try this video.
by Stacy on 30 September, 2009 at 22:24
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.