Archive for the ‘Web Analytics’ Category
Posted on March 12, 2012 by Jim Gianoglio
Now that Pinterest is all the rage, and more sites are starting to put the Pin It buttons next to their images, the next logical step is to track those buttons. Just like we want to know more about the people who share our content on Facebook, Twitter, Google+ and others, we’ll obviously want to do the same for Pinterest.

We can do this with Google Analytics, but there are two problems:
- Pinterest uses an iFrame for their Pin It button, making event tracking difficult
- They don’t have a publicly available API, making social interaction tracking a challenge
Today I’ll show you a workaround for the first problem, while the second problem will be the subject for a later post.
Event Tracking on the Pinterest “Pin It” Button
Because the code for adding the Pin It button sets it up in an iFrame, we can’t just add the event tracking code whenever someone clicks on the button. Tracking across iFrames requires the _getLinkerUrl method to transfer visitor and campaign cookies between domains. This also requires cross domain tracking to be set up between the domains. Since you can’t put your own tracking code on Pinterest.com, that option is out.
The other option is to take the code that Pinterest tells you to copy and paste, and hack around it a little bit. That sounds like fun, don’t you think?
You can get the code from the Goodies page on Pinterest. There are two versions – basic and advanced. The advanced code is asynchronous and lets you add the button to multiple images on the same page. If you only have one instance of the Pin It button on your page, then the basic code is all you need.
From the Pinterest goodies page, once you fill in the details (URL of the page the pin is on, URL of the image to be pinned, and description) the basic code will look like this:
<a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fwww.example.com&media=http%3A%2F%2Fwww.example.com%2Fimage.jpg
&description=Awesome%20description" class="pin-it-button" count-layout="horizontal">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
The line I highlighted in bold is the culprit that inserts the iFrame and takes the joy out of event tracking. It pulls in the pinit.js file (you can see the contents here). To restore our event tracking joy, we need to modify the code above to look like below:
<a onclick="_gaq.push(['_trackEvent', 'pinterest', 'pinned']); window.open(this.href, 'signin', 'height=300,width=665'); return false" href="http://pinterest.com/pin/create/button/?url='document.URL' + &media=http%3A%2F%2Fwww.example.com%2Fimage.jpg&description=awesome%20description" style="position: absolute; background: url('http://assets.pinterest.com/images/pinit6.png');font: 11px Arial, sans-serif; text-indent: -9999em; font-size: .01em; color: #CD1F1F; height: 20px; width: 43px; background-position: 0 -7px;" count-layout="horizontal">Pin It</a>
You should recognize the part in green as the event tracking code. This makes sure that a click on the Pin It button gets recorded in GA as an event. (Don’t forget to track your events as goals!) In the example above, we’re setting the category to “pinterest” and the action to “pinned.” You could also include an optional event label for additional info, like the page they’re on or the image being pinned.
The code in blue is what opens up the new window where the user can write a description for the image and complete the pinning process. The code in orange is all for looks – it includes the styling that controls how the Pin It button will look on the page. This information originally comes from a different source – pinit.html (you can see the source code here). That file, however, is usually referenced by the pinit.js file and placed in an iFrame. Since we are no longer including the pinit.js file, we need to include the styling that is lost.
If you’re using the advanced code for the Pin It button (shown below), you’ll need to remove the first part (the section that starts “Include ONCE for ALL buttons in the page”). In the advanced code, this is the part that calls the pinit.js file. Then, you’ll need to modify the second section (the part that starts with ”Customize and include for EACH button in the page”) to look like our color-coded code above.
<!-- Include ONCE for ALL buttons in the page -->
<script type="text/javascript">
(function() {
window.PinIt = window.PinIt || { loaded:false };
if (window.PinIt.loaded) return;
window.PinIt.loaded = true;
function async_load(){
var s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
if (window.location.protocol == "https:")
s.src = "https://assets.pinterest.com/js/pinit.js";
else
s.src = "http://assets.pinterest.com/js/pinit.js";
var x = document.getElementsByTagName("script")[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent)
window.attachEvent("onload", async_load);
else
window.addEventListener("load", async_load, false);
})();
</script>
<!-- Customize and include for EACH button in the page -->
<a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fwww.example.com&media=http%3A%2F%2Fwww.example.com%2Fimage.jpg&description=awesome%20description" count-layout="horizontal">Pin It</a>
It’s your turn
How are you tracking Pinterest? Do you think Pinterest is even worth tracking? Let us know in the comments!
View Comments (14 Responses) | Categories: Google Analytics, Social Media, Web Analytics
Posted on March 8, 2012 by Phil Anderson
Last week, most of us logged in to a big surprise in our Google Analytics, and it wasn’t a traffic spike, it was the new, new look:

Whoa! Google Analytics, you lookin’ fine.
Now that we’ve had a week to digest the changes, here’s a few of our favorite things that Google has added in this substantial update.
- Sharing of Custom Reports and Dashboards has never been easier.

I think this most affects people who work with clients or have teamwork among analysts, but if you’ve ever wanted to share a custom report with someone before, it was a pain (usually ending up in the wrong profile), and the ability to share Dashboards was just nonexistent. The new interface lets you choose what profile to apply the dashboard/filter easily.
- Less flash!

You can now view Google Analytics on your iPod/iPad and see the line charts. I suspect this also explains why GA feels a little peppier. They are most likely phasing out all flash in favor of HTML 5. (A peek into the source code shows that graphs now come from an Iframe which is rendering things with scalable vector graphics)
- Toggle Buttons are More Clear.

A bunch of features that have been in GA for some time are more apparent now, thanks to a clean new layout of buttons. For me, the Compare Metric and Plot Rows options are much more obvious now. I also really like the Day/Week/Month toggle, it seems cleaner and is definitely less buggy then the old drop-down.
- Sampling Slider.

While you still can’t turn off sampling (unless you use GA Premium), at least it’s possible to show your customers that sampling can be pretty accurate (or inaccurate) depending on the amount of sampling. I’ve played around with this to see what percentage Transaction data gets the most inaccurate. I’m not sure why anyone would want .02% of their data sampled in exchange for speed, but it’s possible now.
- Pretty Thumbnails.

This small bit of eye candy makes the sections in GA really pop out, and makes the overall tool look a little more exciting. Although Daniel Waisberg makes a great point that the $ symbol should be by goals instead of Advertising, but I guess Google doesn’t see it that way!
Still using the old GA? We’re offering a free online webinar to help with the transition. Sign up now, we’re limiting this webinar to the first 90 people.
View Comments (1 Response) | Categories: Google Analytics
Posted on February 28, 2012 by Sayf Sharif
Recently, the brilliant Brian Honigman wrote a blog post here at LunaMetrics about How Nonprofits Can Get The Most Out Of Foursquare which got me thinking about how a nonprofit could get the most out of Google Analytics.
There are some estimates that 60% of websites don’t use any type of Analytics tracking, and that the number is even higher for nonprofits.
We’re not sure why this is. It could be that some people view tools like Google Analytics as very commercial and profit oriented, and therefore something that a nonprofit wouldn’t, or even shouldn’t use. It could be that Nonprofits tend to have passionate people who wear more hats than they would at a commercial enterprise, and they’re doing their best, but data analysis isn’t in their wheelhouse.
(If you’re a Nonprofit and aren’t using Google Analytics for another reason, drop us a comment after this post and let us know why! We’re honestly curious.)
Sometimes people at nonprofits feel that this sort of analytics and tracking is about “selling” and that as a nonprofit it’s somehow gauche to look at their websites as places to track “conversions”, however all the major Nonprofits do just that. There are plenty of things you can and should track as far as Goals and Conversions on your sites. You might not be selling anything, but you’re still engaging people in calls to action.
How Can you Use Google Analytics to track a Nonprofit goal?

If you're losing it, just hold on, Google Analytics will make it better
Well let’s look at something like “Donor Activity”. You might have a place on your website for people to donate money. With Google Analytics you can parse all those donations with various other data points to help you increase your Donor Activity.
For instance you can see where they came from, whether it was a Google Search, or an Email, or a Facebook page, or another website. You can then compare where they came from with donation patterns. Maybe certain emails generate higher levels of donations than others, which can help you tailor your email campaigns to better grab and engage your network.
If they arrived via an organic Google Search you can see what keywords they used, and you can take those keywords and tailor your Search Engine Optimization (or SEO) to get even more people to visit your site. (And hey if you’re interested in SEO for Nonprofits you should check out our SEO Training Day on April 2nd, 2012 in San Francisco, which we’re offering in conjunction with the Nonprofit Technology Network’s annual conference. A full day of nonprofit specific SEO training)
You can look through your visitors and see what pages they looked at, how long they stayed on your site, and which content engaged them, or which content “bounced them” from your site. You can what pages were more likely to get people to donate.
There are so many things you can do to track and improve your efficacy with specific conversions, and so many different types of conversions you could track besides Donor activity.
- How many people are hearing and reacting to your message?
- How many people are visiting your site when you post something on Facebook, and what do they do on your site?
- How much information do they read?
- Are there better ways to get your message out?
- Do people respond better when they come to your site from various social media, or from email campaigns?
- Which campaigns?
- Which methods?
- Which referring websites?
- Are you increasing your networking and email lists?
- What methods work best for that?
- Are you increasing attendance and participation at your events, fundraisers, participation and number of people served by your Nonprofit, or the number of volunteers or volunteer hours?
There are plenty of things that Nonprofits can and should track to help them improve their entire organization.
Why Should A Nonprofit use Google Analytics
There are a number of reasons why a nonprofit would want to use Google Analytics over other software. First of all it’s one of the most sophisticated analytics packages available. It allows you to do more types of tracking, segmentation, conversion tracking, than other pieces of software, sometimes offering more options in certain areas than even paid solutions.
Which brings us to the second reason: It’s free. Nonprofits don’t necessarily need to pinch every penny, but if one of the most sophisticated analytics software packages is available for free, you have to question whether it’s worth paying tens or hundreds of thousands of dollars for a paid solution, that might not give you any additional functionality that you would use. It’s also a hosted solution, which means that Google hosts the data. This frees up your IT department, if you have one, from maintaining a server devoted to your analytics, and simply let Google take care of that.
In addition, it’s easy to use. Google provides free tutorial videos that are quite excellent and there are plentiful resources, websites, and books that can help. On top of that there are opportunities for training both on site, as well as at the Google approved training programs the “Seminars for Success” which are offered by only a few Google certified trainers.
All in all it’s a solution that makes sense even for large and reputable Fortune 500 companies, down to the local Mom and Pop shop, as well as Nonprofits.
Getting Started – Step 1: Don’t Panic
Yes, I stole that from Douglas Adams. It’s applicable though, and something you should hold onto before we go any further. The world of Analytics might be scary, particularly if you’re not technical, but I promise you, that if you follow a few simple steps, you’re going to find that Google Analytics is a tool that can really help your Nonprofit in many ways. So whether you’re taking the initiative or your boss told you to get this done… Don’t panic. Don’t worry. It’s honestly not painful.
Step 2: Check out Google for Nonprofits
If you aren’t already using it, I highly recommend you head over to Google for Nonprofits and sign up. There are a number of benefits, including free or discounted versions of Google Apps, Free (with a catch) Adwords advertising, Premium branding and increased uploads on YouTube, Free licensing for Google Earth, the Maps API and more. If you are a Nonprofit and you’re on the internet, you have no reason not to sign up for this. They also provide a handy checklist for Nonprofits entitled “12 actions to expand your reach“ which gives you great ideas of things you can do to help your Nonprofit reach out online.
And guess what the very first item on their list is?
Step 3: The Most Technical Part

Google Analytics Asynchronous Tracking Code
It’s like ripping a band-aid off, and it’s really not that scary. You need to get the Google Analytics Tracking Code installed on your website. To do this first you need an Analytics account. Head over to Google Analytics and create a new one.
I recommend that if you’re doing this for your Nonprofit, you should create an administrative account in Gmail first, if you don’t already have one. This way you don’t do it on your personal account. Don’t worry. After you create your new administrative account, you can give your personal account admin privileges to the analytics so you’ll be able to access it without constantly changing your login.
So create your new “Nonprofitname@gmail.com” account, and then create the analytics account using that account. It’s quick and relatively painless, and at the end the Google Analytics page provides you with the code to use which you can have your developers cut and paste onto your webpages. OR if you’re using a WordPress site there are a variety of plugins that will help add the code to all your pages for you. I recommend Google Analytics for WordPress if you go that direction.
Be sure to install the newest Asynchronous code and place it in the <head> section of your website code for the best tracking results.
Once the tracking code is installed I recommend reviewing a number of our blog posts including Phil Anderson’s excellent series on increasing conversions from website traffic starting with The Infinite Conversion Loop and moving onto 10 Things to Check in Your Google Analytics.
Step 4: Get Addicted To Your Data
Be careful! If you haven’t had Google Analytics before on your site, it can be a bit addicting to track your numbers, checking day to day… Before you know it you’ll be talking to someone about Custom Reports and they’ll just give you a blank stare in return. Don’t worry! This is normal.
So what can a Nonprofit do to really make use of that data. Well a lot more than I can put in a single blog post, but here are a few fun starter ideas.
1 – Google Analytics in Real Time: Watch your data update within seconds.

Are you placing a television commercial, or participating in some sort of event and want to see immediate data? Well with Google Analytics you can watch that data come in in real time. It’s unfiltered data, so if you have a large number of filters on your profiles, it won’t be totally accurate to a profile, but you can see those hits. If you normally only have 10-20 people on your site, it can be exhilarating to see an immediate and real time impact of your marketing efforts and watch people actually click through your site, submit forms, donate money, etc.
Google Analytics in Real Time: Watch your data update within seconds.
2 – Tracking Your Marketing Campaigns
It’s amazing how many people, even those who already have Google Analytics installed don’t use Campaign tagging. Campaign tagging allows you to parse your data based on your marketing efforts. Sending out an email? You can see which email specifically did better than another. Posting on social media? Does Twitter or Facebook generate more interaction with your information? By using Campaign tagging in all your links you can find out what efforts you are doing are working better than others, and help tailor your ongoing marketing efforts to attack those channels that really work for your Nonprofit better than others.
4 Steps to Better Campaign Data in Google Analytics
3 – Tracking your SEO Progress

SEO seems like magic sometimes, and people want to see what kind of success their SEO campaigns have, or if it’s even worth their time. However Google Analytics provides some great ways to track how many people from which keywords found which pages, and their change over time. You can use it also to track your referral traffic and link bait. If you’re doing SEO for your nonprofit website, and you should, then you can use your Google Analytics data to help in your efforts to improve and gain even more traffic. It’s useful to see the top 20 words and phrases that people search for your website and organization on. What do people want from you, and what are they looking for? This lets you develop content for these terms, and catering to your users helps you build traffic.
You can even look at the bounce rates for keywords (bounce means that the visitor leaves the site without interacting with it at all). Then by seeing keywords with high bounce rates you know to avoid those keywords, because they are bringing in visitors who aren’t finding what they want on your site. OR if it’s a keyword you do want to emphasize then maybe you need to look at your website to see how you can better grab those users on your site who come in via that keyword.
How to use Google Analytics to Track SEO Progress
4- Tracking Your Social Media Engagement
Google Analytics comes pre-installed tracking Google+ sharing, but with some extra tweaking you can track which of your users are logged into Facebook, Twitter, etc while they’re on your site. With some additional page code you can track how many people visit your Facebook pages, how many “Like” your website or specific page content from within your website, etc. Social Media is a big way for nonprofits to communicate with their audience, so it’s very important to track their engagement with your website, rather than relying simply on something like Facebook’s internal Insights. By tracking engagement on your pages, you can tell more about your users behavior, as well as which social networks to target, which content grabs users better, and more.
Tracking Social Media Engagement in Google Analytics
Event Tracking or Social Tracking or Both?
5 – So much more
You can view high bounce rate pages, and review how people got to those pages, and determine if you need to change the content, the keywords, or anything to better retain users to those pages.
You can ensure that the most viewed pages include calls to action, so that you are getting your goals into people’s faces as much as possible. People can’t convert if they aren’t offered an opportunity to do so.
You can do the same on high exit rate pages, and find ways to keep people on your pages rather than pushing them away. Give people an easy out on a donation page for instance to somewhere else on the site, and make them feel ok with not donating.
Use Goals. Determine what you want to do on the site, and set Goals in Google Analytics so that a form has a conversion rate. A donation process has as goal and a funnel so you can see where you lose people along a process. Use the goals in conjunction with other data to determine if some users are more likely to convert than others and leverage that information.
Moving Forward with Google Analytics as a Nonprofit
We’ve only brushed the surface here. Really anything you’re doing on your site you should be tracking to see how you can make it better. Always be testing. Always be checking your data. Always try and improve and do better, and Google Analytics is a great tool for nonprofits to use. It’s powerful, it’s free, and it’s fun to use! If you aren’t leveraging Google Analytics in your efforts on a daily basis, then it’s time to start.
View Comments (1 Response) | Categories: Google Analytics
Posted on February 27, 2012 by Dorcas Alexander
Recently a client asked us to help them do a better job tracking employee visits to their website. For many websites this is a relatively small segment of traffic and often comprises visits from the dev team. But this particular client, like many of our nonprofit clients, has a staff that uses the organization’s website regularly over the course of a normal workday. And so it’s especially important to separate external and internal traffic.

The usual advice for removing internal traffic from your Google Analytics data is one of two methods. Either set up a filter based on your IP address (or range of addresses). Or if your organization is large enough to be its own ISP (Internet Service Provider), then the filtering is even easier.
Internal Traffic is a Moving Target
But neither of these methods address how your employees visit your website on their mobile devices or laptops. They might be out of town for a business trip on a hotel network, at home on their home network, or even on the Wi-Fi at the local coffee shop.
And we all know this is a rapidly growing segment of visitors, especially as more and more people use tablets. Your internal traffic is literally a moving target.
Cookies for Everyone!
Which brings us to a third method, having your employees set a visitor cookie to identify themselves. Google Analytics has a field called User Defined that you can use to filter internal traffic. User Defined is the older version of what are now called Custom Variables – but those aren’t available yet for filtering.
Because a visitor cookie is specific to a computer and browser, your employees can identify themselves on every device they normally use. Simply have them visit a special page that will set the cookie for them, and ask them to visit that page one time on every device and every browser.
Remind Staff to Visit the Cookie Page
After that you’ll be able to identify your internal traffic and filter it, regardless of their IP address or ISP. Of course, if they delete their cookies, they’ll need to visit the page again. So you could remind them periodically, “Hey, here’s that URL we need you to visit. Help us keep our analytics data clean.”
To make it even easier, here’s what the code looks like. Just insert your UA-number where I have UA-XXXXX-YY and publish the page.
<html>
<head>
<title>Remove My Internal Traffic from Google Analytics</title>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-YY']);
_gaq.push(['_setVar','employee']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<h2>Remove My Internal Traffic from Google Analytics</h2>
Visit this page on every computer, tablet, and smartphone, and for all browsers you use on those devices.<br>
</body>
</html>
Create the Filter
You could also choose a different value for _setVar; where I have ‘employee’ you could insert any identifier you like. Remember to create the exclude filter using this identifier and apply it to a test profile – make sure it’s working before applying it to your main profile.

Check Your Profiles
You may also want to create a new profile that includes only internal traffic. Or cross-check everything against your unfiltered profile. (You do have a completely unfiltered profile for troubleshooting, right?) With a glance across profiles you can see that the data is in fact being sent to GA and appears in one profile, while being correctly excluded from another profile.
Tracking employee visits is essential for nonprofits and other organizations with staff who use the website regularly. Adding to the complexity are employees working remotely and the increasing use of mobile devices. The cookie page is a relatively easy to implement solution. What obstacles have you encountered and what methods do you find most accurate for capturing employee data? The comments are yours.
Have you worried about employee visits muddling your analytics?
View Comments (6 Responses) | Categories: Filters, Google Analytics, Mobile Analytics, Web Analytics
Posted on February 20, 2012 by Phil Anderson
Welcome back to the Infinite Conversion Loop. Hopefully since the last post, you’ve not only got your Analytics accurate, but also are getting more visibility into who is visiting your website.

Have you ever found yourself staring at your Analytics data, wondering “What the heck is wrong with these people on my website? Why would 10,000 people come to my site, but only 100 of them decide to purchase anything? I mean my site LOOKS awesome, and I’d give me money.” Unfortunately, we can’t actually view what people are doing without resorting to something illegal… or can we?
ClickTale
Enter ClickTale. ClickTale records a sampling of your visitor’s behavior for an entire session using JavaScript to detect mouse movements, clicks, time on page, etc… it’s able to do this in such a way that it really feels like you are watching a video of someone using your website. ClickTale is pretty pricey ($99/month for the lowest level), but I think running it at least for a month or two will give you all sorts of insight you just can’t get looking at the numbers.

For example, one thing I always wanted to understand was the low usage of the advanced search on my site. I saw in analytics that few people were searching with these advanced options, but I didn’t understand why. ClickTale gave me the other piece of the puzzle, people were TRYING to use the advanced search, but getting confused by the options. As I watched them click radio button after radio button, only to click the Back button 90% of the time, the UI problem became clear.
Another benefit to ClickTale is it also sort of does your cross-browser testing for you, quietly in the night. It logs JavaScript errors, and lets you search on them, so you’ll discover the JavaScript error that you didn’t realize was occurring on IE7 or Firefox 4 for OS X.
The only frustrating thing with ClickTale is that you’ll see people who are clearly confused, but you can’t ask them why!! (I’ll cover this in the next post).
Google Analytics
Since we’re big fans of Google Analytics here at LunaMetrics, if ClickTale is out of your budget, another great option is available to you now in GA.
One of the best new features Google has added recently was Flow Visualization in Google Analytics. Jim does a great job in the videos on that link explaining the basics, so let’s put them to work in figuring out what people are doing.

When you go to the Visitors Flow report, it may be confusing at first. I believe the default view is by Country, which probably isn’t useful for the majority of you out there. I typically choose by “Medium”, since that’s usually the most interesting for understanding how different types of visitors flow (since organic search comes in at the index, affiliates go to the deepest level, and cpc goes to landing pages).
Quickly you can see some interesting things, a quarter of my affiliate traffic is going to 404 pages! Also, almost all of the organic and referral traffic is going to the index of the site.
Keep adding steps on the right until you see all the large patterns. Don’t get too hung up in the outliers that only have a few “connections”. Look for the trends… are people clicking to search and then going back to home? That probably shows they can’t find what they are looking for. Does it seem like an abnormally long set of steps to get to the Checkout? Maybe your sales funnel can be optimized.
I’m sure some of you might be thinking “What about GA’s In-Page Analytics?” Well, it’s there…

But because it doesn’t differentiate between clicks on different buttons (any links with the same URL will be counted equally), I would only use this for the most barebones analysis.
All of this is just the first pass at UI changes to increase conversions. Use these tools to solve the big problems preventing users from converting, next time I’ll show you how to get to really get down to the heart of things.
View Comments (2 Responses) | Categories: Conversion Science, Usability, Web Analytics
Posted on February 14, 2012 by Jim Gianoglio
This is part 1 of a 2-part series on using Google Spreadsheets to make social media measurement easier, quicker and almost completely automated. When you’re done reading this, Part 2 awaits!
There are two problems I’m going to solve for you today:
1. Tracking social media is hard
2. You don’t have time to track social media
Tracking social media is hard
Let’s tackle the first problem. Yes, tracking social media is incredibly difficult. There are a million things you can track, including content on your site that’s being shared, people that are mentioning your brand or products online, tweets, shares, likes, pluses – you name it. It seems like everything is social these days, which makes tracking it kind of like counting grains of sand as they fall through your fingers.
But you have to start somewhere, and the easiest place to start is on your own site. With your own content. Which raises a number of other tracking issues. For instance, there’s a difference between tracking how many people click the social sharing buttons on your pages vs. how many people click on the links in your tweets vs. how many people copy and paste your URL and share it on their own (and how many people click on the links in their tweets/shares/posts etc.).
Again, you have to start somewhere. Today, we’ll start with tracking how many people click on the links to your content that you share on your social networks. This is actually rather easy, and I’ve broken it down into 5 steps:
- Copy the URL of the content you’re sharing
- Paste that URL into the Google Analytics URL builder, along with the following:
- Campaign Source – twitter (or facebook, linkedin, googleplus, etc.)
- Campaign Medium – social
- Campaign Name – blog (or something that signifies the type of content you’re sharing)
- Take the full URL (for example, http://www.yoursite.com/awesome-blog-post?utm_source=twitter&utm_medium=social&utm_campaign=blog) and shorten it with Bit.ly (because every character counts when you only have 140)
- Share that shortened link on the specific social platform that you identified for the utm_source
- Rinse and repeat steps 2-4 for every social network you want to use
Wondering why I chose those source, medium and campaign names? Read up on this refresher for campaign tagging in Google Analytics. Doing the above will make it very easy for you to get insights into which social media channels are worth your time. Just go to Traffic Sources > Sources > Campaigns, click on blog (or whatever campaign name you chose), and do a little happy dance when you see a report like below:

Notice, I ditched the standard data table view for the sexy comparison view.
I don’t have time to track social media
It’s true, the steps above take time. In fact, it used to take me at least 15 minutes to add the campaign parameters, shorten the links, and then share them on the various social networks. I can’t stand wasting time doing repetitive tasks that can be easily programmed. Thanks to Tom Critchlow’s post on how to build agile SEO tools using Google spreadsheets I can choose to spend my time building tools that do the repetitive nonsense for me. I’ve been using Google spreadsheets to hack together tools very quickly to do all sorts of things, including automating the task of tagging URLs with campaign parameters and shortening the links.

I’ve done the dirty work for you, so go grab your copy of the spreadsheet here. Once it’s open, go to File > Make a copy so you can edit the spreadsheet (you may need to sign in to your Google account - even if you were already signed in). All you need to do is enter your Bit.ly username and API Key (you can find that here) on the ‘Technical Details’ tab, then enter the URL of whatever page you’re sharing and voila! This tool takes your URL, appends campaign parameters for Twitter, Facebook, Gooogle+ and LinkedIn and shortens each one for you so you can quickly and easily share those links. How you spend the 15 minutes you saved is up to you, but please take just 2 of those minutes and tweet this post. I don’t ask for much
How it works
This is for those of you interested in peeking behind the curtain to see how this works. The real magic happens on the ‘Behind the Scenes’ tab. You’ll see that cell B3 pulls in the URL that is typed in on the main tab. Columns C, D, and E hold our values for utm_source, medium and campaign.

In cells B8 through B11, you’ll see a formula like this:
=concatenate($B$3, "?utm_source=",C3, "%26utm_medium=",$D$3, "%26utm_campaign=",$E$3)
This simply takes the URL in B3 (the page that you’re sharing) and concatenates that with the values for source, medium and campaign. One thing to note is that instead of a “&” I’ve used “%26″ – which is the URL encoding for the ampersand character. This is necessary for the Bit.ly API.
In cells B13 through B16, we take the campaign tagged URLs from the previous step and run them through the Bit.ly API. The following formula accomplishes that:
=concatenate(importdata(concatenate
("https://api-ssl.bitly.com/v3/shorten?login="&'Technical Details'!$A$4&"&apiKey="&'Technical Details'!$A$7&"&longUrl="&B8&"&format=xml")))
The important thing to notice in the above formula is the use of the importdata function. It lets us pull in the results of the Bit.ly shortening operation. For more details, check out the Google spreadsheet function list.
Finally, back on the main tab (ShareMe!), the Bit.ly shortened links are pulled in from the ‘Behind the Scenes’ tab using the following formula:
=mid('Behind the Scenes'!B13, (find("<url>",'Behind the Scenes'!B13)+5), 20)
So if you want to add more social networks (or change the ones listed), you’ll need to go into the ‘Behind the Scenes’ tab and make your modifications there.
Stay tuned for Part 2
Next time, I’ll show you how to use scripts within Google Spreadsheets to detect when you’ve published a new post, and automatically send an email with the shortened links.
In the meantime, let me know if this is helpful, or if you have other ways to streamline your social media workflow. The comments are yours!
View Comments (7 Responses) | Categories: Google Analytics, Social Media
Posted on February 9, 2012 by Sayf Sharif
Before I even start talking about this, let’s go to code.google.com for the official recommendation on where someone should place their Tracking Code on their webpages…
The Analytics snippet is a small piece of JavaScript code that you paste into your pages. It activates Google Analytics tracking by inserting ga.js into the page. To use this on your pages, copy the code snippet below, replacing UA-XXXXX-X with your web property ID. Paste this snippet into your website template page so that it appears before the closing </head> tag.

The Google Analytics Asynchronous Tracking Code
Ok! Thanks for reading, see you next time!
Just kidding, of course it’s not that simple.
So seriously, where should I put my Google Tracking Code?
We actually get people asking us about this a lot. It’s one of the first items in our audits that we look at. What version of the tracking code are you using, and where is it on the page. There are plenty of variations, but the most common one if it’s not completely up to date, is having non-Asynchronous (or ‘traditional’) tracking code, which is placed at the bottom of the page. So when the first item in our audit says “We recommend you update to the Asynchronous tracking code, and move it’s placement into the <head> of your document, rather than at the end of the <body>” people get worried.
Is it bad to have the Google Tracking Code at the bottom of the page? I read that you should put it there at the bottom, rather than up in the head because it makes your site faster.

Should you place the tracking code in the <body>?
The quick and dirty answer is that yes it’s safe to put the new code really anywhere on the page, and for 99% of users, you’ll want to use the Asynchronous code and put it in the head of your document. There are a few exceptions/alterations which I’ll note in a minute.
The less quick part of that answer is that it WAS bad to put the traditional Google Tracking Code in the head of your webpage in the past, so if you read some book or blog purporting to speed up your website extolling the virtues of putting the Google code at the bottom of the page, then they may have been correct once, but they aren’t anymore. The speed of the internet, and all that jazz.
Google released the Asynchronous Tracking code on December 1st, 2009. Prior to that point all we had was the traditional code, and it worked like most other basic JavaScript code. That is to say that it would go one line at a time. So when your browser loaded up a line of code, it would load that line only, and then wait till that line was fully loaded. Then, and only then, would it move to the next line, and then load that line, etc. Like a single conveyor belt. The problem with that design though, is that if you ran into a snag the entire page would hang. So if the Google Tracking Code back then was placed at the top of your webpage in the head of the document, then the speed your site loaded was partly determined by how quickly Google sent you that code. If it took Google 10 seconds to send you that code, that was 10 more seconds your visitor had to wait to view the page. That’s why it was recommended to put that code at the very bottom of the page. That way if it stalled in loading the files from Google, at least your page was loaded first.
The Asynchronous code though works differently. Rather than say a SINGLE conveyor belt, now there are multiple ones, and the rest of your page can load up regardless of how long it takes to retrieve data from Google. The tracking code loads up on its own conveyor, while the rest of your site loads on another.
And on top of that the Asynchronous code is designed to be downloaded only once from Google, and then it’s served from your cache (i.e. it’s saved on your computer and you won’t have to download it again), which makes it that much faster.
You lost me poindexter, what does that mean for me?
It means the asynchronous tracking code averages a 5% improvement in tracking data, with some sites showing 10 and even 20% improvement in their data. If you use Adwords, it closes in on 100% accuracy with the asynchronous code.
The asynchronous code is faster, and therefore you get better more accurate numbers as to how many people are actually visiting your site.
What if I have events or things happening on the page, where I need to record user actions, and the tracking code hasn’t loaded yet?
Well, that problem would also happen if you had the non-async code firing at the bottom of the page, but with async it’s much better. Even if it takes time to load the ga.js file from Google, it’s already set up the tracking variables on the page, and will store the events you perform before the actual file is loaded. Once the file loads, then all the events backlogged will be sent to Google. It’s not PERFECT, but for the most part it will capture events that happen prior to the Google tracking code has even finished loading, and send them after the code has been loaded.
So do I need to move it to the head of all my pages? I have a lot of pages, and that’ll take a lot of time.

You can put your tracking code anywhere, but it's better in the <head>
Nope. You can put it anywhere you want really, and It’ll run anywhere on the page whether it’s in the head or the body. It’s recommended you put it in the head though, so it can be as accurate as possible.
You see, the Pageview is recorded only after that code is loaded up. So the sooner you load the code, the sooner that Pageview is recorded. Let’s say you have a big blog page, and it’s a slow loading one, taking even 10 to 20 seconds to load everything up. If your Google Code doesn’t start until the end of the page, it can get held up, just like the old non-asynchronous code used to hold up OTHER lines of code. Except now it’s holding up the tracking code. If a visitor to your site hits the page, and then leaves it before the tracking code fires the Pageview, then you lose that visitor. They now become a new direct visit to whatever page of the site they landed on. This can make all sorts of data on your site incorrect.
So it’s best practices to use the Asynchronous code in the head of your page, it won’t slow down the rest of your page from loading, and by having it there it won’t GET slowed down by the rest of the webpage either, so it’ll fire sooner, and you’ll get a more accurate count of what pages your visitors visit.
So what are the exceptions? When is it BAD to run the tracking code up in the head?
I mentioned before that there ARE a few exceptions. One is if you’re setting custom variables on the page.
If you set a Custom Variable on your webpage then it will essentially sit on your page, waiting for either a pageview to be tracked, or an event to be called. If you set a custom variable on a page and don’t track a page or an event after it, that custom variable will NOT get passed to Google. Sometimes you might not be tracking any events on a page, but you’ll want to set a custom variable. Because of how code is delivered, it’s possible that custom variable might only get generated AFTER the head document. Usually a page can be coded so that these variables can be determined before the HTML is delivered and then you can have the custom variables created in the head of the document as well. Maybe it could theoretically be put in the head, but the developers didn’t build the page that way, and you’re not willing or able to have them redo everything. In those cases you can set a Custom Variable anywhere on the page, and then rather than tracking the pageview in the head of the document, you remove this line:
_gaq.push(['_trackPageview']);
from the Asynchronous code, and then insert it later in the page wherever you like, after the custom variables are set. That way the code loads up, it doesn’t interrupt the page load, and you can then track custom variables on the page itself anywhere they appear, as well as retaining the benefit of loading the tracking code early.
HOWEVER, this can also reduce accuracy, because if a user navigates away before that trackPageview is called, then you’re facing the same problems that the traditional code presented in the first place. Another option would be to use Event Tracking. An event being fired will also submit that queued custom variable, so you could fire an event tied to that custom variable. Essentially a throwaway event.
_gaq.push(['_setCustomVar',1, 'Status', 'Logged In']);
_gaq.push(['_trackEvent', 'Custom', 'PageLoad', 'Setting Logged In State',0,true]);
A couple notes on this:
First we’re setting the Custom Variable, we’re assigning it to key space 1 (of 5), and we’re calling it Status, and setting the value to Logged In. That’ll sit there until an Event or Pageview is tracked.
So we do the event. We set it to a Custom category group, we definte the action as PageLoad because a user isn’t specifically interacting with this event. Then we set the Label as to what the event is doing. We add a 0 to the value (you don’t have to add an actual value there if we’re not using it, but I’m personally uncomfortable passing nothing). We also then set the non-interaction value to true. This is also key if you use an event here. If you don’t set it as true, then the event is considered a page interaction, and it will affect your bounce rate from the landing page. Essentially rather than someone coming to your page looking at it and hitting the back button being considered a ‘bounce’ It would not be considered one because the user ‘interacted’ with the site. So we set this to true, so that isn’t considered in that respect.
But wait, I read something on Google’s own support pages that said I shouldn’t do this?
You mean this page?
Yeah, you don’t believe everything you read, do you? That’s old outdated support information.
So if we update is it going to change my data? Like am I all of a sudden going to see more pageviews or something?
It’s possible. It depends on your site, where the code was, what sort of speed and pageload times you have. By updating you should see the data you’re getting change, maybe a little, maybe a lot. But it’ll be MORE ACCURATE data. Here we tend to side with getting the data to be as accurate as possible, even if there is a bit of a break in the levels of reporting.
If I don’t update, will my site continue to track data?
Sure. It probably won’t be as accurate, but depending on your site it’s conceivable it’s not a huge data difference. The main functions are all loaded from the same place, the ga.js file. The main difference is how it loads, how fast it loads or is even cached in your browser, and therefore the accuracy of your data.
So what should I do?
If you’re NOT using the up to date Async code you should update to using that. You’ve really got to have some serious things going on to NOT update. Does it need to be in the head of the document? No, it won’t kill you to have it at the bottom of the page, but if you CAN move it to the top, then you should because it’ll be faster and more accurate. If you don’t know of a reason to keep using the non-async code at the bottom of the page, and you’re not using custom variables… Then really there is no reason to NOT update it and move it to the top of the page. You’ll have more accurate data, you’ll get newer and better tracking features, and more. Come on. Everyone’s doing it.
View Comments (7 Responses) | Categories: Google Analytics
Posted on February 7, 2012 by Brittany Baeslack
PPC experts know how important the ability to test and measure results is. Thankfully, we have the ability to do this with sitelinks as well. The ‘Ad Extensions’ tab within the Google AdWords UI offers advertisers data that is specific to sitelink performance. Also, keep in mind that all of this data is rolled up when viewing data for the campaign overall – there’s no need to add the numbers together to get the total, as AdWords already displays the campaign data in that way.

One question I get often, however, is how advertisers can view more detailed data for sitelinks, such as conversion data or performance for individual sitelinks. While we don’t have the ability to view this data within the AdWords UI, we can see it within Google Analytics.
Set up Tracking Parameters
In order to track in Analytics, you’ll first need to attach tracking parameters onto the URL of the sitelinks you are using. I usually set mine up as sitelink = [description of sitelink here], so for example:
www.CompanyA.com/contactus?sitelink =contactus
Remember, when attaching tracking parameters to any URL, use ‘?’ to separate the URL from the tagging if the URL does not already have a question mark in it; if the URL already contains a question mark, you’ll want to separate your URL from your parameter with ‘&’ (even if the URL already contains an ampersand). SearchEngineLand offers a great article on how to set up parameters.
View the Content Report
Once the parameters are in place and you have confirmed the link still works correctly, you can view data for sitelinks within Google Analytics by clicking on Content, followed by Site Content and then Landing Pages. Search for your designated parameter in the search box. From here, you can drill down in the Google Analytics interface to determine additional information about the sitelinks, such as which campaigns triggered them, etc.

Custom Reports
Another way to view sitelink performance within Analytics is to set up a custom report that will be saved within the analytics profile for quick viewing in the future. To do so, you’ll need to ensure that tracking parameters have been set up for the sitelink URLs (discussed above).
Within the Google Analytics profile you wish to track sitelinks in, click on Custom Reporting, then New Custom Report. Name the report so that you will be able to easily identify it as the Sitelinks report when you view the Custom Reporting tab (I always name mine Sitelinks Report). Since my sitelinks report usually only has one tab, I just name it “Sitelinks.” I also prefer to view the data by Explorer as the type.

Choose the metrics you would like to view for your sitelinks – this can be limited to just visits, or as many metrics as you’d like, including bounce rates, time on site, etc. Metrics can be combined into one metrics group or multiple metric groups. Name your groups something easily identifiable.

Next, you’ll choose the dimensions for which you’d like to see the sitelink data. I normally like to view campaigns, ad groups, keyword and landing page data at the very least. Note: Landing Page (Listed under Content) must be chosen for the custom report filter to work! The dimensions you choose can be basic like this, or contain more detailed data such as ad slot position, day of the week, medium, etc.

You’ll then need to add a filter for the custom report to pull data for. Click Add Filter, then click Content, Landing Page. Ensure the first box says “Include.” Click the drop down box that says “Exact,” and click on “Regex.” Then, in the box to the right of that, type in the tracking parameter that you would like use to filter for sitelinks. I set my custom reports to filter for the word “sitelink” within the landing page, because my parameter contains that word.

Click save, and you now have a Custom Report you can use to view sitelink information quickly. You will only have to make the sitelink report one time, but you can always update it to view more/less data.
Here is what your completed Custom Report page might look like, before clicking Save:

Implement sitelinks in your Paid Search campaigns, and use the AdWords UI and Google Analytics to track their performance.
View Comments (5 Responses) | Categories: Paid Search, Web Analytics
Posted on January 31, 2012 by Michael Harrison
If you’re not familiar with the Goal Copy Firefox extension, you can read the original post here.
It seems like everyone I know is using Chrome now. It’s fast, it’s simple, it has developer tools built right in. It’s a fantastic browser and it deserves every bit of browser share that it’s taking away from the Big Two (Firefox and IE).
That being said, I do almost all of my Google Analytics debugging in Firefox. I love HttpFox and you’ll pry Firebug (and, to a lesser extent, Firecookie) from my cold, dead hands. Maybe I’m just set in my ways, but it’s the way I do things, and while I love Chrome for everyday browsing, I do all my heavy lifting with the ‘Fox.
Which is why I keep updating GoalCopy. This latest version works with Firefox 9. It still only works with the old interface, but an update for GA v5 should be ready in a few weeks.
For now, just download the latest version of GoalCopy here and get to copying! You might encounter a weird glitch where only the Find/Replace toolbar shows and the Copy/Paste options are nowhere to be found. Just re-enable it through the new Firefox menu as shown below:

What about you? Have you made the switch to Chrome, or are you sticking with Mozilla? What sort of features do you want to see in a Google Analytics add-on? Please leave a comment below and let me know!
View Comments (3 Responses) | Categories: Firefox, WA Tools
Posted on January 26, 2012 by Dorcas Alexander
After you learn about campaign tagging for Google Analytics, you may be excited that you can add all that extra information to a simple little link – so excited that you want to put campaign tags on every kind of promotional link that leads to a web page on your site. But there’s one kind of link that should never get campaign tags. You should never put GA campaign tags on internal banners or on-site promotions that lead from one page of your site to another.
Why You Shouldn’t Use GA Campaign Tags for Internal Promotions
Imagine this sample scenario: A visitor clicks an email campaign link from your latest marketing effort and lands on your site. Google Analytics records the traffic source and starts collecting data for the visit. Of course you hope that the visitor will continue to view pages on your site and maybe even convert on an important goal like registering for an upcoming conference or buying your latest e-book. When they do, you’ll be able to attribute that conversion to the campaign and evaluate that campaign’s success.
But what happens if the visitor clicks an internal banner with campaign tags before they convert? Google Analytics records a new traffic source and starts a whole new visit. So now you have at least two problems: You’ve split what was really one visit into two visits, skewing your data. And you can’t tie the original email link directly to the conversion, because the conversion happens in a separate visit.
To track internal promotions without splitting visits and losing credit for conversions, try one of these instead:
- Add your own campaign parameters (not GA campaign tags) to the links and view the data in your Content/Pages reports
- Use event tracking when a visitor clicks an internal banner or promotional link and view the data in your Content/Events reports
Alternative #1: Add Your Own Campaign Parameters
The first method involves making up your own tags, ones that GA won’t recognize and will pass right along into your Pages reports with the rest of the URL. Instead of utm_source or utm_medium, for example, you might simply add something like “from=promo” to the target link:
http://www.anything.com/buy-ebook.html?from=promo
Or you could use a more detailed scheme if, for example, you run internal promotions with many types of links in different places. So you might have one parameter similar to campaign name, like “campname=e-book”, and another parameter that describes the links, like “camplink=home-page-banner” or “camplink=side-nav-feature”:
http://www.anything.com/buy-ebook.html?campname=e-book&camplink=home-page-banner
http://www.anything.com/buy-ebook.html?campname=e-book&camplink=side-nav-feature
As long as you stay away from Google Analytics utm parameters, these types of URLs will appear in your Content/Pages reports and you can tell by the number of pageviews exactly how many times a visitor clicked the tagged link to arrive there.

Alternative #2: Use Event Tracking
The second method involves adding a bit of code to the link on the page. Inside the anchor tag (a href=”…”) include an onclick event like this (a href=”…” onclick=”…”). And in the onclick event, add the event tracking code using an event category and action like “internal promo” and “home-page-banner”:
onclick="_gaq.push(['_trackEvent', 'internal promo', 'home-page-banner', this.href]);"
After the event category and action it’s a good idea to include the optional event label. For the label you can simply write the target (href) of the link, using this.href.
View this data in your Content/Events reports by drilling into Top Events through the “internal promo” category, where you can see the how many times someone clicked each of your different internal promotional links.

Combine with Custom Variables for Goal Data
Okay, so where’s the goal data? You may have noticed that Google Analytics has Goal tabs in Traffic Sources reports, but not in Content reports. The whole point of these alternatives was to keep your original traffic source intact so you could tie it to a conversion. But you probably also want to know how well your internal promotions lead to conversions, too, right? Of course you do.
Well, there’s another set of reports that has Goal tabs, where you can combine conversion data with a set of dimensions that you define, and that’s the Audience set of reports. You can write a custom variable with the parameters or event data you created in either alternative described above. And then you can easily compare goal conversion data in a single table that lists all your internal promotions.

The thing to remember when writing custom variables is that the data needs to piggyback on a _trackPageview or _trackEvent call.
For the event tracking alternative, add _setCustomVar to the onclick event, like this:
onclick="_gaq.push(['_setCustomVar', 1, 'internal promo', 'home-page-banner', 2]);_gaq.push(['_trackEvent', 'internal promo', 'home-page-banner', this.href]);"
For the other alternative where you make up your own campaign parameters, I suggest adding _setCustomVar to the page that’s the target of the link, right before the usual call to _trackPageview. You can use a little Javascript to read the URL and write the custom variable according to the campaign parameters that appear there. For example, if the URL is:
http://www.anything.com/buy-ebook.html?campname=e-book&camplink=side-nav-feature
The resulting custom variable code (placed before the call to _trackPageview) could be something like this:
_gaq.push(['_setCustomVar', 1, 'e-book', 'side-nav-feature', 2]);
In both cases I’ve set a session-level custom variable (indicated by the number 2 above), and I’ve set the custom variable to slot number 1 (out of 5). If you are already using that slot then you’ll need to assign it to another one. Read our post about how to keep track of custom variable slots and scopes for more guidance.
No More Split Visits
Avoid the split-visit problem. Keep visit data together by keeping internal and external promotions separate. Track your external campaigns with GA’s utm parameters and try one of the above alternatives for internal campaign tracking. And tie both external and internal promotions to conversion data to evaluate the success of each.
What methods do you use for tracking internal promotions? And how do you tie them to conversion data? Please share in the comments.
View Comments (6 Responses) | Categories: Conversion Science, Custom Variables, Google Analytics