Google Tag Manager 101 Part 4 - Social Media

20/07/2015

Google Analytics already records all of the incoming traffic to your website that arrives from a Social Channel. This includes Facebook, Twitter, LinkedIn, Pinterest, Instegram, Youtube, Google+ and many other platforms. These visits are separated into a Channel called Social that you will see under Acquisition/All Traffic/Channels. Slightly confusingly, Social visits are also included in the Acquisition/All Traffic/Referrals report.

To see all of the Social reports, go to Acquisition/Social. The Overview shows how successful each Social Network is at converting your visitors.

There is also a report in the Social section called Plug-ins and this is the report that we want to populate with our Google Tag Manager tags. Social Plugins record social actions that users take when visiting your website. This can include visits to your Twitter page, Facebook Likes of a page or LinkedIn Shares of your articles. These are indicators of engagement with your website content and we track all of these on our Blog pages. So feel free to Share this article (see those buttons over to your left) so I can test that it is working OK!

These social events can be configured easily with Google Tag Manager, in fact you may have already completed some of the work if you implemented external link tags in Part 3. The only reason why GTM may not be the tool for the job is if your website uses a 3rd party plugin for social sharing such that GTM cannot detect the link clicks - in this case, you will need to ask your website developers for some ideas.

1. CLICKS TO SOCIAL SITE PAGES FROM YOUR WEBSITE

If you are already sending external links to Google Analytics (see Part 3) then your Social Link Clicks will already be recorded as Events. You can gather them in the Social section in addition to firing the event or edit the external link trigger to not fire on certain external URLs (for example for URLs containing facebook, twitter, linkedin).

The tag you need to build to send Social data is shown below - the crucial setting is "Track Type = Social". I use "Action = Page" to indicate a link click through to our Twitter page and the Action Target will record the page the user was visiting when clicking on the link.

2. LIKES OF YOUR PAGE

I don't have a example of recording Page Likes as we do not have that functionality on our website but the instructions that follow for Social Sharing will cover all you will need to know to set it up. If you use a 3rd party plug-in to serve up the Like button, it could be tricky to record the event. You will know by running Google Tag Manager Preview and seeing if any click is recorded when you click on Like. If GTM does not register the click then the Like button effectively does not belong to the website.

3. SOCIAL SHARING

The Cucumber Blog has Social Sharing enabled - the 5 buttons on the left-hand side that you should spot when reading this article. What we will set up is an event being sent of type Social whenever somebody clicks on one of these buttons. 

Luckily the buttons are all served up in a similar way, so we only require one trigger and one tag to achieve it.

Preview

By far the easiest way to determine how to build your trigger is to use Google Tag Manager Preview mode. When I click on one of the buttons, a gtm.linkClick is recorded and the Variables tab tells me everything I need to know. I have highlighted the good parts.

I can use the Click (you actually use Click Classes to trigger on this Variable) as the trigger - even though the full string is different for each click, they all start with the same text).

Trigger

We will only Enable this trigger for the Blog and whenever Click Classes starts with "at4-share"

Pretty easy so far. To build the Tag, we can use the other Variable we identified called Click Text. This is conveniently formatted to use as our Social Network. We set "Action=Share" and again record the Page Path to determine which Blog Article was shared.

Tag

So how do you see the statistics for your Social Data. Well from Social/Plug-ins click on Social Source and Action, add a secondary dimension of Social Entity and all the data is there in one report.

Google Analytics Social Media Report

Go to Part 5, covering the tracking of form submissions. 

Please add comments below or send me a message on Twitter


Written by Nick Baker

Previous
Previous

Claire Ma - YiA Internship 2021

Next
Next

Google Tag Manager 101 Part 3 - Creating Link Tags