How To Set Social Share Tracking And Analytics

3 min

Social share tracking


Everybody wants to know the real value of the time, spent for social content writing and promoting. Some of us using advertising in social networks. How we can evaluate our ROI?

The answer is – Social Share Tracking!

It’s not that hard to set up everything and to keep an eye on the time/money spent on SMM.

I will show you on the Facebook example. The same thing you should do with every Social Network, you want to get analytics from.

Though some social share plugins doesn’t work with TagManager – so either ask in support, or just try. 

Actually social share tracking – is set like event tracking, so if you ever faced with that before – it will be a piece of cake for you.


What you will need to set it:

Your site with Google tag manager code in the right place (you can check it with Google Tag Assistant Tool)

Google Analytics Account

Google Tag Manager Account

Go to the Google Tag Manager and

1. Create a new container version
2. Open the variables and enable (or check that they are enabled the following)
2.1. If you are using new versions of Tag Manager you can proceed from the step 6. 

enable the build-in variables

Then we need to set macros to collect the data.

After the October 2014 updates the standard Macro menu item on the left side of interface has changed to the Variables (but the main idea the same)

3. Create a new Custom Variable and name it Social network
4. Select Java Script Custom Code as the type of data variable

Insert this part of code to the body

    return {{Click Element}}.parentNode.getAttribute('title');
5. Save the variable
6. Create the trigger name it Facebook share clicks

Choose “Click” then set “All elements” as a type and set the rule for this trigger:

Activate the trigger when an event occurs and the fulfillment of all these conditions

Click Classes (choose from drop down) contains icon-facebook (inspect element on the FB button – in my case – icon-facebook)

NB! If you use different social plugins to set your social share clicks – make sure you are using unique value name for your trigger – if all of them have facebok in the class – maybe one has _facebook and the other maybe icon-facebook

7. Repeat this steps with all the needed social networks.
I made triggers for:

Facebook, Pinterest, Google-plus and Twitter

8. Create new Tag

Name it – Social Share Clicks

as the type of tag use “Universal Analytics”

as a type of track “Social Networks”

Tracking parameters of social activity

Net: Facebook

Act: Share

Target action: Page Url

8.1. go to your Google Analytics Account and copy the Tracking ID

Insert like on the screenshot belowsocial clicks tag

8.2. Add created triggers to your tag settings

adding triggers to the tag

9. Repeat step 8 with all the needed social networks, creating a single tag for each and adding the specific trigger

Check the settings before publishing the new tag version with the Preview mode

Copy the url of the page, where your share buttons are

Click “Preview” button at the right upper corner in your tag manager account, open the new tab, paste and go the url

If everything is set correctly – you will see this

10. Publish your container version 

11. Check your data in your GA account here


Like it? Share with your friends!


Px-lab is a team of professional web developers and creative web designers with passion to create and give life to elegant, beautiful, clean and useful templates and WordPress themes with meticulous attention to every pixel and with scientific approach in development.


Your email address will not be published. Required fields are marked *