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

2. Install The New JavaScript Code

Put this in your <HEAD>

Then add the following to the bottom of the page, before the closing </BODY> tag:

NOTE 1: Remember to replace Your-App-Id with your Facebook App Id and with a url to an image on your website.  (This last line can probably be implemented with just an in-line JavaScript call, but I’m posting this code as-is because it “Works on My Site”)

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:


Google Plus

Gmail/Google Login


4. View Data in Analytics

Choose your custom segments:

View your beautiful data!

Beautiful Social Data 2

(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)

WordPress Plugins

Here is a WordPress plugins that implement Tom Anthony’s initial code:

  1. Adapt Partners Social Media User Detection WordPress Plugin


    1. Definitely something that’s missing. I will look into it when I get a chance. Basically, you just need to find an image on Linkedin that is only accessible when a user is logged in — so then you just try to load that image. If it loads, you are logged in. If it doesn’t, then you are not logged in…

      Just need to track down an image… 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s