Was That Visitor Signed‑in?

October 7, 2010

With GA you can track custom information about a visitor, a specific visit, or a particular page with Custom Variables.

One of the things people often want to do is to know when the visit is a signed-in visit.

The GA JavaScript is pretty easy for this.  Assuming you’re not using any other Custom Variables, it might look like this (Depending on whether you’re using the traditional or async syntax.):

pageTracker._setCustomVar(1,”Signed-in status”, “Signed-in”, 2);

OR

_gaq.push([“_setCustomVar”, 1, “Signed-in status”, “Signed-in”, 2]);

(Here is the GA documentation for _setCustomVar and information on how to set a Custom Variable.)

The trick is to execute this JavaScript at the right time — right after the visitor does actually sign-in.  And there are probably as many correct ways to do it as there are websites.

One of the easier ways to implement this is to include the JavaScript in an HTML element that only gets included in the webpage when the visitor is signed in.

For example, here are 2 screenshots of the aboutus.org website. The first is the signed-in version.  The second is the signed-out version.

Notice how the block of HTML in the Top-Right Corner changes.  This block would be a good candidate for where to execute the GA code.  Just include the GA JavaScript from the example above in the “signed-in” block and you’re done.

The downside is that although this is simple and fast, it would execute the JavaScript for every page.  This isn’t a problem from the reporting side, but since it is only required to execute once for tracking purposes, executing it every time is needless.  Realistically, it executes pretty quickly and should not slow down the user experience.

Once you’ve set the custom variable for your signed-in visits, you can then look at that segment of visits and see how they stack up. Are they more likely to click on ads? Sign up for your newsletter? Purchase a product? Of course, you can get these insights by going to the Visitors > Custom Variables report in your GA, or by creating a Custom Report to pull in just the information you want to see for that segment.