www.optimizesmart.com Open in urlscan Pro
2606:4700:3036::ac43:899d  Public Scan

URL: https://www.optimizesmart.com/social-interactions-tracking-through-google-analytics/
Submission: On October 04 via api from US — Scanned from DE

Form analysis 1 forms found in the DOM

GET https://www.optimizesmart.com/

<form method="get" id="searchform" action="https://www.optimizesmart.com/">
  <input type="text" value="Search website" name="s" id="s" onblur="if (this.value == '')  {this.value = 'Search website';}" onfocus="if (this.value == 'Search website') {this.value = '';}"><input type="submit" s="" value="GO" class="submit">
</form>

Text Content

 * Home
 * About
   * Testimonials
 * Services
   * Google Analytics & GTM Consulting
   * Digital Analytics Training
 * Blog
 * Books
 * Digital Analytics Training
 * Contact


GOOGLE ANALYTICS SOCIAL TRACKING – TWITTER, FACEBOOK, GOOGLE PLUS AND LINKEDIN

Analytics

My Step-By-Step Blueprint (32 Pages) For Selecting The Best KPIs


GET THE FREE E-BOOK ON KEY PERFORMANCE INDICATOR – KPI (32 PAGES)

Download the FREE ebook



Last Updated: June 8, 2023

In this post you will learn to track Google +1, Facebook likes, Facebook sends,
Facebook unlikes, Twitter tweets, Twitter follows and LinkedIn shares in Google
Analytics.

But before we move forward, you need to understand the difference between event
tracking & social tracking and the difference between normal users’ interactions
& social interactions:

1. Event tracking is implemented by calling the _trackEvent() method whereas
social tracking is implemented by calling the _trackSocial() method.

2. Event reports are available under the ‘Behavior’ menu and Social reports are
available under the ‘Acquisition’ menu in your Google Analytics account.


THE ‘_TRACKSOCIAL()’ METHOD

To send social interaction data to Google Analytics we call the _trackSocial()
method wherever we have added the share button/social plugin:

_gaq.push([‘_trackSocial’, network, socialAction, opt_target]);

Here,

network => Name of the social network being tracked e.g. Facebook, Twitter,
LinkedIn etc.

This parameter is required to be passed to the trackSocial method.

socialAction => Type of the social action being tracked e.g. Like, Unlike, Send,
Tweet etc.

This parameter is required to be passed to the method.

opt_target => This parameter is optional.

It is a URL which receives the social action.

_trackSocial seems to track only those social sharings which were done through
social plugin/share button on your website. It doesn’t seem to track re-tweets
or sharing done on some third-party site or third-party plugins like Tweetmeme.

So if your blog post is tweeted 10 times via a share button on your website and
then later re-tweeted 65 times then also _trackSocial counts only 10 tweets.

In short, I don’t see social interactions being tracked across the web. This is
not what I was expecting from Google.


GET MY BEST SELLING BOOKS ON ATTRIBUTION MODELLING

 * Learn to implement attribution modelling in your organisation
 * Understand the customer purchase journey across devices
 * Determine the most effective marketing channels for investment

 Click book covers to find out more


TRACKING GOOGLE +1 SOCIAL INTERACTIONS

Step-1: Make sure you are using the latest Google Analytics Asynchronous
Tracking Code on your website.

Step-2: Copy the Google +1 button code from here and paste it wherever you want
to display the button on your website. Google Analytics automatically tracks the
social interactions associated with Google +1s once you have installed the
Google +1 button on your website.  So you don’t need to place any special
tracking code for Google +1 button.

Step-3:  After few days/weeks, go to ‘Plugins’ report (under Traffic Sources >
Social) in your Google Analytics account. Then click on the primary dimension
‘Social Source and Action’. You will see the following report (provided your
tracking is set up correctly):





My Step-By-Step Blueprint (32 Pages) For Selecting The Best KPIs


GET THE FREE E-BOOK ON KEY PERFORMANCE INDICATOR – KPI (32 PAGES)

Download the FREE ebook




TRACKING FACEBOOK SOCIAL INTERACTIONS

For Facebook, social actions can be: ‘like’,’unlike’, ‘follow’, ‘send’,’comment’
etc.

 * Through ‘like’ button a user can share your web page on his Facebook profile
   with just one click.
 * Through ‘send’ button a user can send (share) your web page to his friends.
 * Through ‘comment’ button a user can comment on any web page of your website.

Step-1: Make sure you are using the latest Google Analytics Asynchronous
Tracking Code on your website.

Step-2: Upload ‘ga_social_tracking.js‘ file to your web server. You can grab
this file from here.

Step-3: Enable Social Tracking by adding the following code after your Google
Analytics Tracking Code and before the </head> tag:

<!-- Enabling Google Analytics Social Tracking code Starts Here -->
<script type="text/javascript" src="https://www.your-domain.com/wp-content/uploads/ga_social_tracking.js"></script>
<!-- Enabling Google Analytics Social Tracking code Ends Here -->

The final code will look like the following:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxx-x']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'https://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- Enabling Google Analytics Social Tracking code Starts Here -->
<script type="text/javascript" src="https://www.your-domain.com/wp-content/uploads/ga_social_tracking.js"></script>
<!-- Enabling Google Analytics Social Tracking code Ends Here -->
</head>

Don’t copy past this code without modification.

Replace “UA-xxxxxx-x” with your Google Analytics account number and
‘www.your-domain.com’ with your website address where you have installed
the ‘ga_social_tracking.js’ file.

Step-4: Install the Facebook ‘like’ button from here. The ‘Like’ button code
will look something like this:

<fb:like send="true" show_faces="false" layout="button_count" width="150"></fb:like>


Step-5: Add following line of code just before before the <fb:like /> tag:

<script src="https://connect.facebook.net/en_US/all.js#xfbml=1&appId=501839739845103"></script><script type="text/javascript">_ga.trackFacebook();</script>

So the final code will look like this:

<script src="https://connect.facebook.net/en_US/all.js#xfbml=1&appId=501839739845103"></script><script type="text/javascript">_ga.trackFacebook();</script><fb:like send="false" layout="button_count" width="150" show_faces="false"></fb:like>

Don’t copy-paste this code without modifying it first.

Here The “#appId=xxxxxxxxxxx” is a random app ID that Facebook generates which
allows you to access Insights for the button.

Don’t use my appID. When you create your own Facebook ‘like’ button, Facebook
will generate an appId for you. Use that appID.

Note: The appId is not a requirement for the ‘like’ button to work.

Step-6: Copy-paste the modified Facebook ‘like’ button code wherever you want to
display the Like button.

Step-7: After a few days/weeks, go to ‘Plugins’ report (under Traffic Sources >
Social) in your Google Analytics account. Then click on the primary dimension
‘Social Source and Action’. You will see the following report (provided your
tracking is set up correctly):





If you want to track all the social actions provided by Facebook then you need
to install all the social plugins of Facebook. Get the list of plugins.

Note: you can track only those social actions for which you have installed
social plugins on your website. For e.g. if you want to track Facebook comments,
then you first need to install Facebook comments plugin on your website.

> If you are using Universal Analytics on your website, then checkout this
> article to track Facebook social interaction: Tracking Facebook Social
> Interactions with Google Analytics and Google Tag Manager


TRACKING TWITTER SOCIAL INTERACTIONS

For Twitter, social actions can be: ‘tweet’, ‘click’, ‘follow’ etc.

Step-1: Make sure you are using the latest Google Analytics Asynchronous
Tracking Code on your website.

Step-2: Make sure that the file  ‘ga_social_tracking.js‘ is uploaded on your web
server.

Step-3: Make sure you have enabled the Social Tracking as explained above.

Step-4: Install the official twitter button on your website. The ‘twitter’
button code will look something like this:

<!-- Twitter button code starts here -->
<a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="seohimanshu">Tweet</a><script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
<!-- Twitter button code ends here -->

Don’t copy-past this code without modification. Use your own Twitter handle.

Step-5: Copy paste the following code just before the </head> tag:

<!-- Load Twitter JS-API asynchronously -->
<script>
(function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = 'https://platform.twitter.com/widgets.js';
// Setup a callback to track once the script loads.
twitterWidgets.onload = _ga.trackTwitter;
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>


Step-6: After a few days/weeks, go to ‘Plugins’ report (under Traffic Sources >
Social) in your Google Analytics account. Then click on the primary dimension
‘Social Source and Action’. You will see the following report (provided your
tracking is set up correctly):





Note: You can’t track Twitter social actions through the Tweetmeme button or
other Twitter type buttons.

> If you are using Universal Analytics on your website, then checkout this
> article to track Twitter social interaction: Tracking Twitter and Linkedin
> Social Interactions in Google Analytics

Get this 70 page detailed checklist containing screenshots, step-by-step
instructions and links to articles


DO YOU WANT TO SET UP GOOGLE ANALYTICS 4 (GA4) FAST AND CORRECTLY?

Yes I want the ebook


TRACKING LINKEDIN SOCIAL INTERACTIONS

Step-1: Make sure you are using the latest Google Analytics Asynchronous
Tracking Code on your website.

Step-2: Make sure that the file  ‘ga_social_tracking.js’ is uploaded on your web
server. 

Step-3: Make sure you have enabled the Social Tracking as explained above.

Step-4: Add the following code after your Social Tracking Code and before the
</head> tag:

<!-- LinkedIn Share Button tracking code starts here-->
<script type="text/javascript">
function LinkedInShare() {
_gaq.push(['_trackSocial', 'LinkedIn', 'Share']);
}
<!-- LinkedIn Share Button tracking code ends here-->

The final code will look like the following:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxx-x']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'https://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- Enabling Google Analytics Social Tracking code Starts Here -->
<script type="text/javascript" src="https://www.your-domain.com/wp-content/uploads/ga_social_tracking.js"></script>
<!-- Enabling Google Analytics Social Tracking code Ends Here -->
<!-- LinkedIn Share Button tracking code starts here-->
<script type="text/javascript">
function LinkedInShare() {
_gaq.push(['_trackSocial', 'LinkedIn', 'Share']);
}
<!-- LinkedIn Share Button tracking code ends here-->
</head>

Don’t copy-past this code without modification.

Replace “UA-xxxxxx-x” with your Google Analytics account number and
‘www.your-domain.com’ with your website address where you have installed
the ‘ga_social_tracking.js’ file.


Step-4:  Install the official LinkedIn share button on your web page(s). The
button code will look like this:

<script src="//platform.linkedin.com/in.js" type="text/javascript">
 lang: en_US
</script>
<script type="IN/Share" data-counter="right"></script>


Step-5:  Modify the LinkedIn button code by
adding: data-onsuccess="LinkedInShare" like this:

<!-- Linkedin button & tracking code starts here -->
<script src="https://platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/Share" data-counter="right" data-onsuccess="LinkedInShare"></script>
<!-- Linkedin button & tracking code ends here -->


Step-6:  Copy-paste the modified button code wherever you want to display the
LinkedIn button.


Step-7: After a few days/weeks, go to ‘Plugins’ report (under Traffic Sources >
Social) in your Google Analytics account. Then click on the primary dimension
‘Social Source and Action’. You will see the following report (provided your
tracking is set up correctly):





> If you are using Universal Analytics on your website, then checkout this
> article to track LinkedIn social interaction: Tracking Twitter and Linkedin
> Social Interactions in Google Analytics

My Step-By-Step Blueprint (32 Pages) For Selecting The Best KPIs


GET THE FREE E-BOOK ON KEY PERFORMANCE INDICATOR – KPI (32 PAGES)

Download the FREE ebook




RELATED ARTICLES

 1. Understanding Facebook Referral traffic in Google Analytics
 2. Learn to correctly track Facebook Referral traffic in Google Analytics
 3. Tracking Facebook ‘Likes’ and ‘Unlikes’ in Google Analytics
 4. Why Facebook and Google Analytics data do not match
 5. Complete Guide to Google Analytics for Facebook


OTHER ARTICLES ON SPECIALIZED TRACKING IN GOOGLE ANALYTICS

 1.  How to see Organic Search Keywords in GA4 (Google Analytics 4)
 2.  Google Analytics Ecommerce Tracking Tutorial
 3.  Google Tag Manager Event Tracking Tutorial
 4.  Google Analytics Event Tracking Tutorial
 5.  Google Analytics Store Visits Tracking Tutorial
 6.  Offline Conversion Tracking in Google Analytics – Tutorial
 7.  Ecommerce Tracking Google Tag Manager (GTM) – Tutorial
 8.  Tracking Virtual Pageviews in Google Tag Manager – Tutorial
 9.  Google Tag Manager YouTube Video Tracking
 10. Google Analytics Virtual Pageviews Tutorial
 11. Google Analytics YouTube Integration & Analysis Tutorial
 12. Google Analytics for Facebook Tutorial
 13. Cross Domain Tracking in Google Analytics – Complete Guide
 14. How to use two Google Analytics codes on one page
 15. How to correctly use referral exclusion list in Google Analytics
 16. Google Analytics Calculated Metrics – Tutorial
 17. Creating your own Google Analytics Tag Auditing System
 18. Google Tag Manager Search Tracking without Query Parameter
 19. Tracking Google Analytics Paypal Referral and other payment gateways
 20. How to Track Phone Calls in Google Analytics 4 – Call Tracking Tutorial
 21. How to track leads in Google Analytics via CRM
 22. Postbacks in Google Analytics Explained
 23. Subscription & Recurring Revenue Analytics in Google Analytics
 24. Track the Impact of Google Analytics Cookie Consent on Website Traffic
 25. Tracking Offline Conversions in Google Ads
 26. Implementing Scroll Tracking via Google Tag Manager
 27. Scroll Depth Tracking in Google Tag Manager – Tutorial
 28. Site Search Tracking In Google Analytics Without Query Parameters
 29. Google Tag Manager Youtube Video Tracking via YouTube Video Trigger
 30. How to Correctly Measure Conversion Date & Time in Google Analytics
 31. Google Analytics Social Tracking – Twitter, Facebook, Google Plus and
     LinkedIn
 32. Cross Domain Tracking in Google Analytics – Complete Guide
 33. Google Analytics Linkedin & Twitter Tracking
 34. Creating Content Group in Google Analytics via tracking code using gtag.js
 35. Google Analytics Site Search Tracking via Query Parameters
 36. Google Analytics Site Search Tracking Tutorial
 37. Creating and Using Site Search Funnel in Google Analytics
 38. How to add Facebook Pixel to Google Tag Manager
 39. AMP Google Analytics Tracking – Learn to track AMP pages
 40. Setting up Sales Funnel across websites in Google Analytics
 41. Google Analytics 4 Regex (Regular Expressions) Tutorial




REGISTER FOR THE FREE TRAINING...




"HOW TO USE DIGITAL ANALYTICS TO GENERATE FLOODS OF NEW SALES AND CUSTOMERS
WITHOUT SPENDING YEARS FIGURING EVERYTHING OUT ON YOUR OWN."



Here’s what we’re going to cover in this training…

#1 Why digital analytics is the key to online business success.

#2 The number 1 reason why most marketers are not able to scale their
advertising and maximize sales.

#3 Why Google and Facebook ads don’t work for most businesses & how to make them
work.

#4 Why you won’t get any competitive advantage in the marketplace just by
knowing Google Analytics.

#5 The number 1 reason why conversion optimization is not working for your
business.

#6 How to advertise on any marketing platform for FREE with an unlimited budget.

#7 How to learn and master digital analytics and conversion optimization in
record time.




Register For The Webclass Now!
Save My Seat For The Webclass!
   




MY BEST SELLING BOOKS ON DIGITAL ANALYTICS AND CONVERSION OPTIMIZATION



Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and
statistics in order to accurately interpret data and take actions, which can
quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing
optimization program and will help you dramatically reduce your cost per
acquisition and increase marketing ROI by tracking the performance of the
various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing
channels for investment. This book has been written to help you implement
attribution modelling. It will teach you how to leverage the knowledge of
attribution modelling in order to allocate marketing budget and understand
buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google
Ads (Google AdWords) and Facebook. It will teach you, how to leverage the
knowledge of attribution modelling in order to understand the customer
purchasing journey and determine the most effective marketing channels for
investment.




ABOUT THE AUTHOR


HIMANSHU SHARMA


 * Founder, OptimizeSmart.com
 * Over 15 years of experience in digital analytics and marketing
 * Author of four best-selling books on digital analytics and conversion
   optimization
 * Nominated for Digital Analytics Association Awards for Excellence
 * Runs one of the most popular blogs in the world on digital analytics
 * Consultant to countless small and big businesses over the decade


Copyright © 2023 OptimizeSmart.com All rights reserved.
 * Privacy Policy and Terms of Use
 * Contact
 * Books
 * Blog
 * Services
 * About

To Benefit From GA4 The Most, Learn And Master BigQuery. Get the GA4 BigQuery
Ebook (83 pages).


Download the FREE ebook
X

error: Alert: Content is protected !!
We use cookies on our website to give you the most relevant experience by
remembering your preferences and repeat visits. By clicking “Accept All”, you
consent to the use of all the cookies.


Reject AllAccept AllRead More
Manage consent
Close

PRIVACY OVERVIEW

This website uses cookies to improve your experience while you navigate through
the website. Out of these, the cookies that are categorized as necessary are
stored on your browser as they are essential for the working of basic
functionalities of the ...
Necessary
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly.
These cookies ensure basic functionalities and security features of the website,
anonymously.

CookieDurationDescriptioncookielawinfo-checkbox-analytics11 monthsThis cookie is
set by GDPR Cookie Consent plugin. The cookie is used to store the user consent
for the cookies in the category "Analytics".cookielawinfo-checkbox-functional11
monthsThe cookie is set by GDPR cookie consent to record the user consent for
the cookies in the category "Functional".cookielawinfo-checkbox-necessary11
monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to
store the user consent for the cookies in the category
"Necessary".cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR
Cookie Consent plugin. The cookie is used to store the user consent for the
cookies in the category "Other.cookielawinfo-checkbox-performance11 monthsThis
cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the
user consent for the cookies in the category
"Performance".viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie
Consent plugin and is used to store whether or not user has consented to the use
of cookies. It does not store any personal data.

Functional
functional
Functional cookies help to perform certain functionalities like sharing the
content of the website on social media platforms, collect feedbacks, and other
third-party features.
Performance
performance
Performance cookies are used to understand and analyze the key performance
indexes of the website which helps in delivering a better user experience for
the visitors.
Advertisement
advertisement
Advertisement cookies are used to provide visitors with relevant ads and
marketing campaigns. These cookies track visitors across websites and collect
information to provide customized ads.
Analytics
analytics
Analytical cookies are used to understand how visitors interact with the
website. These cookies help provide information on metrics the number of
visitors, bounce rate, traffic source, etc.
Others
others
Other uncategorized cookies are those that are being analyzed and have not been
classified into a category as yet.
Save & Accept
Powered by



Step 1: Enter Your Email Address
Email
Save Your Seat Now