Back in February 2012, Tom Anthony wrote a couple of great posts on how to detect if visitors were logged into a social network and then how to use Google Analytics to track this information.
Here is a modification of the original code and steps to track everything in a single CustomVar slot.
1. Read Tom Anthony’s Posts
Put this in your <HEAD>
Then add the following to the bottom of the page, before the closing </BODY> tag:
NOTE 2: The code above is configured to log your Social Traffic login status in Custom Variable Slot 5. Change this number if you want a different slot.
3. Setup Custom Segments
If you setup the code above properly, you should see data similar to this in your Analytics Account under the appropriate CustomVar (#5 in our case):
What you want to do is setup Custom Segments so you can isolate individual networks when the user is logged into multiple networks at the same time. This is very similar to how it was done in the original post, but here are the screen shots for the 4 networks tracked:
4. View Data in Analytics
Choose your custom segments:
View your beautiful data!
(Note: We had a bug with our Facebook tracking when we initially set this up – hence the strange zero-to-hero traffic spike with Facebook towards the end of the graph)
Here is a WordPress plugins that implement Tom Anthony’s initial code: