If you’re NOT on the HyperArts Blog, click here!
NOTE: There have been issues with the LinkedIn Share Button tracking registering a share on each page load, without the user ever clicking the button. However, this appears to have been resolved. BUT it still seems that I’m getting more LinkedIn Shares showing up in my Google Analytics than are actually occuring. I’d love to hear from others about this.
In my article Tracking Social Interactions with Google Analytics, I showed how to have social actions (send, share, etc.) tracked in your Google Analytics account (using the NEW version of Analytics and the asynchronous tracking code).
You can now track LinkedIn Share button clicks with Google Analytics
It’s pretty easy. Here’s how….
First, get the LinkedIn Share button code
You can get the code for your LinkedIn Share button on the Publisher page. Below, for example, is the code for the having the counter to the right of the button:
<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/Share" data-counter="right"></script>
You can change the “data-counter” variable to reflect your preference for where the counter appears or if it appears at all, as shown below:

- Display above the button: data-counter=”top”;
- Display to the right of button: data-counter=”right”;
- No counter displayed: just omit the data-counter variable completely.
Now you need to add an additional parameter to the code LinkedIn provides in order to trigger the Google Analytics when the user shares your content via the LinkedIn Share Button: data-onsuccess="LinkedInShare".
Place the resulting code:
<script type="IN/Share" data-counter="right" data-onsuccess="LinkedInShare"></script>
within the <body> ... </body> tags of your file, where you want the LinkedIn Share Button to appear.
Add JavaScript to your file to make it work
Now you’ll see the purpose of the data-onsuccess="LinkedInShare" you added to the provided Share Button code.
The following JavaScript — the “LinkedInShare” function — should be placed within the <head> tag of your file, preferably after the JavaScript that calls the Google Analytics JavaScript (ga_social_tracking.js):
<!-- Google Analytics Social Button Tracking -->
<script type="text/javascript" src="/js/ga_social_tracking.js"></script>
<!-- LinkedIn Share Button tracking-->
<script type="text/javascript">
function LinkedInShare() {
_gaq.push(['_trackSocial', 'LinkedIn', 'Share']);
}
</script>
NOTE: Read my Google Analytics Social Tracking article for more detail on adding the ga_social_tracking.js file.
Viewing your tracking results in Google Analytics
As mentioned in my other posts on this topic, you MUST use the “New Version” of Google Analytics in order to track social clicks.
Also, you MUST use the “asynchronous” tracking code on your site, replacing the old version completely.
NOTE: You can read my previous post on setting up the new Google Analytics and getting your asynchronous tracking code.
To view your tracking metrics, click: Visitors > Social > Engagement (or Pages or Actions).
Your results, if your tracking is properly set up, will look similar to this:

What I’ve learned from tracking LinkedIn Share button clicks
The most amazing thing that became immediately apparent was just how many were using the LinkedIn Share button. Even more than they are using the Like Button.
I also noticed that Google +1 seems, at least on our blog, to be in third place in terms of use.
I was also surprised by the number of Facebook “unlikes” … It appears people use this function much more than I thought. I’m puzzled by that number and not sure what’s at work there.
I’d like to hear from you, in the comments, about your experiences with Google Analytics social tracking.
Resources
- Tutorial: Add Google Analytics Social Interaction Tracking to your Facebook Tabs
- How to Track Your Facebook Comments Box with Google Analytics Social Tracking
- Google Analytics Technical Info for Social Tracking
- Google Analytics Blog Post on Social Tracking
- Google Analytics Social Tracking Help Page
- Google’s Asynchronous Usage Tracking Guide
- Google Analytics Help Center
- Google Analytics: How to Add a Web Property
- Article on Tracking LinkedIn Share Button
