Articles
How to Track Twitter Traffic in Google Analytics
This article is a short how-to guide about connecting your Twitter account to Google Analytics and tracking Twitter traffic.
Table of contents
- How to track traffic from Twitter in Google Analytics
- How to track paid Twitter campaigns in Google Analytics
- How to automatically import Twitter Ads cost data into Google Analytics
- How to track Twitter interactions on your site with Google Analytics
- How to track Twitter widget and embedded tweet performance with Google Analytics
Long story short: although Twitter is a social network website, you can’t connect your Twitter page directly to Google Analytics. Twitter just doesn’t offer this opportunity. But since you’re reading this, you probably want to figure out how to track your Twitter statistics all the same. So let’s look for a workaround.
If you want to see how well your Twitter account is performing, you can go to https://analytics.twitter.com.
Not only does Twitter’s official analytics platform provide useful information on how popular and engaging your tweets are, it also allows you to export this data for further processing. If you want to see how well Twitter performs for your site, Google Analytics may bring you the necessary insights.
Analyze all campaigns from Twitter, Facebook, Google Ads, Instagram and other advertising channels in one dashboard. Compare the effectiveness of ad campaigns and effectively allocate your marketing budget. With OWOX BI, you can automatically import cost data from Twitter Ads to Google Analytics and Google BigQuery.
How to track traffic from Twitter in Google Analytics
The good news is that Google Analytics tracks traffic from Twitter by default. Maybe this data will be enough for you to take further action.
- Open Google Analytics.
- Go to Acquisition —> All Traffic —> Source/Medium.

Your source (where your visitors come from) should be twitter.com or t.co, and your medium should be referral (meaning visitors came to your site via a link on another site). Pick the relevant options in the list to find more information on Twitter traffic.

How to track paid Twitter campaigns in Google Analytics
If you use promoted tweets, Google Analytics can help you measure their effectiveness as well. For that, you’ll first need to customize the links you’re using in your ads with campaign tags.
The easiest way to do that is with the Google Analytics URL Builder.

Here’s how you can fill out the fields there:

After that, you can go back to your Acquisition —> All Traffic —> Source/Medium report and notice two kinds of traffic:
- Twitter.com / referral — This is your organic Twitter traffic.
- Twitter.com / social — This is Twitter traffic from your paid ads.

Click the last option to study your traffic from paid promotions on Twitter and find insights. But for deeper analysis you need to import the cost data.
How to automatically import Twitter Ads cost data into Google Analytics
OWOX BI is designed to help you get much more from your data by consolidating it from separate systems.

For instance, with OWOX BI, it takes only seconds to import and analyze cost, click, and impression data from your Twitter campaigns in Google Analytics. Merge it with cost and CRM data and you’ll have the most comprehensive base for your analysis.
How to track Twitter interactions on your site with Google Analytics
If you have Twitter-related buttons on your site, you can track and analyze their performance with Google Analytics.
There are two Twitter buttons you can place on your site via publish.twitter.com:

Note: Twitter also offers variations of the Share button in the form of Mention and Hashtag buttons. These act just like the Share button, only instead of a predefined link they start with a mention of an account or a hashtag. The instructions below can be used to track them as well.
To analyze the performance of the Follow and Share buttons, you’ll need to go through a series of steps that you might want to assign to your webmaster. Here they are.
Overview: The goal of the following actions is to create a Twitter button click listener via Google Tag Manager to catch your users’ interactions and pass them to Google Analytics.
- Create a Twitter listener tag in Google Tag Manager.
Tag type: Custom HTML
Tag title: cHTML Twitter Listener - Insert this code into the HTML section of the window.
<script>
if (typeof twttr !== 'undefined') {
twttr.ready(function (twttr) {
twttr.events.bind('tweet', tweetIntentToAnalytics);
twttr.events.bind('follow', followIntentToAnalytics);
});
}
function clickEventToAnalytics() {
dataLayer.push({
'event': 'socialInteraction',
'socialNetwork': 'Twitter',
'socialAction': 'click',
'socialTarget': window.location.href
});
}
function tweetIntentToAnalytics() {
dataLayer.push({
'event': 'socialInteraction',
'socialNetwork': 'Twitter',
'socialAction': 'tweet',
'socialTarget': window.location.href
});
}
function followIntentToAnalytics() {
dataLayer.push({
'event': 'socialInteraction',
'socialNetwork': 'Twitter',
'socialAction': 'follow',
'socialTarget': window.location.href
});
}
</script>
- Click on the Triggering block section and select All Pages.

- Check if the new tag is working: click Preview in Google Tag Manager, navigate to the page of your site where the Tweet button is installed, and see if clicking it fires your socialInteraction tag in the console.
- Create a trigger that will recognize a socialInteraction event.
In Google Tag Manager, proceed to Triggers and create a new trigger with the following parameters:
- Trigger type: socialInteraction
- Custom Event: This trigger fires on
- Event name: All Custom Events

- Now you need to create three variables in order for Google Analytics to learn what kind of action the click has triggered, what social media channel is involved, and what will happen as a result of the click. Open the Variables window in Google Tag Manager:

And create the following three variables with these parameters:

- Create a Google Analytics tag.This tag will fire after the following sequence of actions:
- Your custom HTML Twitter listener tag has fired
- The visitor has clicked the Tweet button
- The Twitter listener has spotted the click and created a socialInteraction data layer as a trigger
- The trigger has launched a Google Analytics tag
To do this, create a new tag in Google Tag Manager.
Choose the Google Analytics — Universal Analytics tag type. Select Track Type:
- If you choose Event, you’ll see the necessary data in Google Analytics in Behavior —> Events. The click data will be seen both in real-time and in reports.
- If you choose Social, you’ll see the click data in Acquisition —> Social —> Plugins. The collected data won’t be seen in real-time and will be available only after 24 to 48 hours.
Define social tracking parameters:
- Network: socialNetwork
- Action: socialAction
- Action Target: socialTarget
Select socialInteraction as the firing trigger.

Finally, you’re done.
Now you can track the performance of your Tweet buttons in Google Analytics via Behavior —-> Events or Acquisition —> Social —> Plugins depending on the Track Type you’ve chosen in the Google Analytics tag.
How to track Twitter widget and embedded tweet performance with Google Analytics
Unfortunately, you can’t do this right now.
When you embed a tweet or a Twitter widget in your site, you basically insert a frame with dynamic content you have no control over. So the activity inside of it (like button presses) can’t be tracked by Google Analytics.
Summing up
Now you can find all data about advertising campaigns, user actions on the site and online transactions in Google Analytics. With the help of the data collected, you can draw conclusions about the effectiveness of a particular channel and allocate marketing budget.
This is good, but not the best option. There are still returns, canceled orders, and offline communications with customers that do get into GA by default.
To analyze complete data from all customer touchpoints, set up end-to-end analytics with OWOX BI and merge all your data in Google BigQuery. Sign up for a demo for more details.

Our clients
grow
22%
faster
Grow faster by measuring what works best in your marketing
Analyze your marketing efficiency, find the growth areas, increase ROI
Get demo