I'm a big fan of analytics data; therefore I try to collect stats about anything – like visitors that check my web pages/profiles. It’s no different with my Last.fm profile.
Here’s what you need to do in order to get analytics data popping up at your Google Analytics account in respect to your Last.fm profile:
First, let’s configure GA side…
1 - Go to Google Analytics and click the Gear icon at the top right of any page and create a new Web Property:
Figure 1 - Creating a new Last.fm Google Analytics Web Property
2 - Name the Web Property and in the Web Site URL field enter your Last.fm profile URL and click Create property:
Figure 2 - Filling Last.fm Web Property with the correct data
3 - Take note of the Web Property ID assigned to your new Web Property:
Figure 3 - Checking Web Property ID that’ll be used when configuring Last.fm profile
Now let’s configure Last.fm side:
4 - Edit your Last.fm profile clicking in the Edit link located in the right side of your profile page:
Figure 4 - Edit button used to get access to Last.fm profile data
5 - Head to the “About You” field and add this line at the end:
Do not forget to click the Save details button.
Two things related to that img URL deserve a note here:
► You’re using the Last.fm GA Web Property ID, for example UA-1234567-89 taken from step 3 above.
► You’re pointing to your Last.fm profile at the last part of the URL.
DO CHANGE these two parts accordingly.
Interesting enough to try is that if you copy & paste the URL from step 5 in your browser, you get this result:
Awesome! NoJSStats does its magic and all GA data -- every single item is assembled and packed into the Request URL's query string (everything after the '?'). For more technical details, see this StackOverflow question: Why does Google Analytics use __utm.gif?
This is everything you need to do. Easy, no?
If you have problems
I have tested this workflow and it’s indeed working as expected. In case you can’t get it working:
If you check the Tracking Code status in GA it says: "Tracking Not Installed".
Figure 5 - Last.fm Tracking Code status
Analytics data appear within a time frame. It's not real-time at the moment.
If you still do not see any data after a day or two, please leave a comment in this post and I’ll try to help.
You should also see data on GA about your own visits to your profile! You can block this from being counted. Check this: How do I exclude my internal traffic from reports?
One of the advantages of using this approach instead of others like FLAG counter that I usually see all over Last.fm profiles is that you keep your data private and get way more stats from your visitors.
Last.fm is missing visitor Analytics features in its current incarnation. I sure hope it implements something interesting in this area.
For now, I hope you get a better insight of how your profile is performing in the internetz.