Update: Which Social Networks Are Your Visitors Logged Into

Back in February, 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.

After the post, there was some discussion about how there are only 5 CustomVar slots in the standard version of Google Analytics, and how it would be nice to consolidate all the Social Media logged in statuses into a single Custom Var.

Well here is the code and steps to track them all in a single Custom Var slot

To implement this using Universal Analytics please read Mark Hoad’s post here: http://aberrant.me/cool-google-analytics-hacks-using-the-new-universal-analytics-js/

1. Read Tom Anthony’s Posts

2. Install The New JavaScript Code

Put this in your <HEAD>

Download the above code here

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

Download the above code here

NOTE 1: Remember to replace Your-App-Id with your Facebook App Id and http://www.yourdomain.com/pixel.png 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:

Facebook

Google Plus

Gmail/Google Login

Twitter

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

There are already 2 (that I know of) WordPress plugins that implement Tom Anthony’s initial code:

  1. Adapt Partners Social Media User Detection WordPress Plugin
  2. Springest’s Social Analytics WordPress Plugin
 I assume it’s just a matter of time before they update their code to be able to cram the tracking into a single CustomVar (although for those already using the old way using multiple CustomVars you will probably want to adjust your Custom Segments to include an OR clause in order to report on data from both formats).

Additional Credits…

A huge thank you to Tom Anthony for the original code that triggered this and to our dev team at Fresh Air Educators, Inc for extending and implementing this new feature!

7 thoughts on “Update: Which Social Networks Are Your Visitors Logged Into

    • 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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s