How to Track X Ads Traffic in Google Analytics | OWOX BI

GA4 Tracking PPC Strategies
Demo

This article is a short how-to guide about connecting your X Ads account to Google Analytics 4 and tracking X Ads traffic in GA4.

Long story short: although X is a social network website, you can’t connect your X page directly to Google Analytics 4, which you can do, for example, for Microsoft Ads

X just doesn’t offer this opportunity. But since you’re reading this, you probably want to figure out how to track your X or X Ads statistics all the same. So, let’s look for a workaround together.

If you want to see how well your X Ads account is performing, you can go to https://analytics.twitter.com.

Not only does X Ads official analytics platform provide useful information on how popular and engaging your tweets are, but it also allows you to export this data for further processing. If you want to see how well X Ads performs for your site, Google Analytics may bring you the necessary insights.

Allocate your marketing budget wisely

Analyze campaigns from Twitter, Facebook, Google Ads, Bing, and LinkedIn Ads with a single dashboard

Start Free Trial
Measure CPO and ROAS in GA4

Note: This post was originally published in Apr 2019 and was completely updated in Late 2023 for accuracy and comprehensiveness on Google Analytics 4.

Why You Should Use Google Analytics 4 With X Ads?

Utilizing Google Analytics 4 (GA4) alongside X Ads is advantageous as it provides an in-depth perspective on the traffic flow from X to your website. With its focus on user behavior and event-based tracking.

GA4 goes beyond mere page views, capturing specific actions of users arriving from X. This detailed data assists in refining your X tactics for improved engagement and conversion rates. Moreover, it supports more targeted and personalized content strategies on X.

How to track traffic from X in Google Analytics

The good news is that Google Analytics 4 tracks traffic from X Ads by default. Maybe this data will be enough for you to take further action.

  1. Open Google Analytics 4.

  2. Go to Acquisition —> Life Cycle —> Traffic Acquisition

Acquisition Report in GA

By default this standard GA4 report use session default channel group as the main dimension, where traffic that is coming from X Ads is grouped with other social network under the referral channel group.

default channel group

That is where you can select to group sessions by source / medium or just source.

sessions source

Your source (where your visitors come from) should be x.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 X Ads traffic.

You can also find the data on New users and Sessions by First user source in the Acquisition —> Overview Report.

Acquisition Overview Report

How to Track Paid Twitter Ads Campaigns in Google Analytics

If you use promoted tweets, Universal Analytics 360 (which is still available for paid users) as well as GA4 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 the OWOX UTM Builder. The OWOX UTM Builder is designed to create custom, trackable URLs for marketing campaigns. By utilizing this tool, you can significantly enhance the return on investment (ROI) of your campaigns by tracking and analyzing various campaign aspects, such as the source of traffic, the medium used, and other vital details.

Uncover in-depth insights

10 Google Analytics 4 reports for monitoring of basic metrics

Download now

Bonus for readers

10 Google Analytics 4 reports for monitoring of basic metrics

Use parameters like utm_source, utm_medium, utm_campaign, utm_term, and utm_content in your campaign URLs.

Note: Please make sure you have added utm_id code to your campaigns, so GA4 can match your costs with conversion data. 

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

When creating your X Ads, include the URL with the UTM parameters. Ensure each campaign or ad has unique UTM parameters for precise tracking.

After that, in Universal Analytics 360, you can go back to your Acquisition —> All Traffic —> Source/Medium report and notice two kinds of traffic:

  1. Twitter.com / referral — This is your organic X Ads traffic in Google Analytics.

  2. Twitter.com / social — This is X Ads traffic from your paid ads.

Acquisition —> All Traffic —> Source/Medium report

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.

In Google Analytics 4, navigate to Reports  —> Acquisition  —>Traffic Acquisition report. This report shows user acquisition data including source, medium, and campaign based on your UTM parameters. You have the option to generate custom reports for a more in-depth analysis. 

Google Analytics 4 provides detailed insights into user engagement. Use the “Engagement” and “Conversions” sections to analyze how users from your X Ads campaigns interact with your site and complete conversion events. Look into user paths and event-specific data to understand user behavior better.

To create custom social traffic reports in Google Analytics 4 (GA4), follow these steps:

  • Go to 'Advertising' in Google Analytics 4 to view the Advertising Snapshot which includes the social traffic.

  • Create exploration reports using various visualizations like tables, funnels, or paths.

  • Apply a filter to focus on social traffic.

  • Use the 'Session Default Channel Grouping' dimension (or 'Default Channel Grouping'/'First User Default Channel Grouping' for different data views).

  • Set the filter to match 'Social' in the chosen dimension.


Advertising Snapshot

This process will allow you to analyze both organic and paid social traffic in your reports, and you can modify the filter to concentrate on specific channels if needed.

How to automatically import X Ads cost data into Google Analytics 4

OWOX BI is designed to help you get much more from your data by consolidating it from separate systems.

For instance,  OWOX BI simplifies the process of importing cost data from Twitter Ads to Google BigQuery through effortlessly configurable pipelines.

 Say goodbye to manual data cleaning, processing, and updating tasks. With our solution, you effortlessly obtain ready-to-use, consistently updated datasets. 

Streamline the automatic import of cost data from Twitter Ads to Google Analytics 4, enabling you to compare campaign costs, CPC, and ROAS within a unified report for well-informed decision-making.

Blend advertising data across platforms, merge with website conversions data, revenue data from the sales CRM, build attribution models, and you’ll have the most comprehensive data analytics setup.

Hassle-free data analysis and reporting

Easily collect, prepare, and analyze marketing data. Stay on top of your marketing performance

Start Free Trial
Measure CPO and ROAS in GA4

How to track X Interactions on your site with Google Analytics 4

If you have Twitter-related buttons on your site, you can track and analyze their performance with Google Analytics 4.
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, except 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 aim of the outlined procedures is to implement a Twitter button click listener through Google Tag Manager. This listener will capture user interactions and seamlessly relay the data to both Google Analytics 4 and Google analytics(Universal Analytics) if you use it.

Step 1: Create a X Ads listener tag in Google Tag Manager.
Tag type: Custom HTML
Tag title: cHTML Twitter Listener

Step 2: Insert this code into the HTML section of the window. This code will send data to the dataLayer in GTM when a Twitter interaction occurs

Step 3: Click on the Triggering block section and select All Pages.

Step 4: 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.

Step 5: 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​

Google Analytics 4 allows for the creation of custom events either through the GA4 interface or using GTM.

Tag creation in GTM

Step 6: 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:

Variable Configuration

Create the following three variables with these parameters:

Step 7: 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.​ 

For Universal Analytics choose the Google Analytics — Universal Analytics tag type. For Google Analytics 4 choose Google Analytics: GA4 Event Tag.

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. In Google Analytics 4, Reports  —> Engagement  —> Events.

  • 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.​ GA4 does not have a dedicated "Social" section. Instead, GA4 uses an event-based model. Utilize Google Tag Manager to establish event tracking for interactions on Twitter. You can send custom events to GA4 when users interact with Twitter buttons on your site. GA4 offers robust real-time reporting capabilities. You can view real-time interactions under the "Realtime" section.

Define social tracking parameters:

  • Network: socialNetwork

  • Action: socialAction

  • Action Target: socialTarget

Select socialInteraction as the firing trigger.

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. And in GA4, Reports  —> Engagement  —> Events

Key Points

Customization: GA4 requires a more hands-on approach to set up and track custom events compared to Universal Analytics.

Data Availability: Unlike Universal Analytics, where social plugin data might take 24-48 hours to appear, GA4's real-time reporting allows you to see social interactions as they happen.

Analysis: GA4 provides more advanced tools for data analysis, but it might require a bit more effort to set up and interpret the data compared to the more straightforward social reports in Universal Analytics.

In GA4, you have more flexibility in how you track and analyze Twitter interactions on your site, but it requires setting up custom events and using the various reporting and analysis tools within GA4 to interpret this data. The shift from a predefined social report to a more customizable event-based model is a key difference between Universal Analytics and GA4.

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 (like button presses) can’t be tracked by Google Analytics for Twitter.

Google Analytics 4 (GA4) offers more advanced tracking capabilities compared to its predecessor, Universal Analytics. However, there are still inherent limitations when it comes to tracking interactions within an iframe, such as an embedded tweet or Twitter widget, due to the same-origin policy and the nature of how iframes work.

Google Analytics 4 introduces enhanced measurement features and the capability to automatically monitor a broader spectrum of user interactions.. However, tracking user interactions within an iframe that loads content from a different domain (like Twitter) remains a challenge for several reasons:

  • Cross-Domain Tracking Limitations: The embedded content is hosted on Twitter's domain, not the website's domain, creating challenges due to browser same-origin policies.

  • Lack of Direct Access: You cannot insert tracking scripts directly into the Twitter iframe content, limiting the ability to monitor interactions within it.

  • Complex Workarounds Required: While some advanced methods (like using postMessage API) exist, they are complex and may not fully capture all user interactions within the iframe.

Key Takeaways

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 conclude the effectiveness of a particular channel and allocate a 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.

Book a demo

Gain clarity for better decisions without chaos

No switching between platforms. Get the reports you need to focus on campaign optimization

Book a demo

FAQ

Expand all Close all
  • How to check Twitter Analytics?

    To check Twitter Analytics alongside Google Analytics, first access Twitter Analytics through your Twitter account for tweet-specific data. Then, use Google Analytics to track website traffic from Twitter by adding UTM parameters to your tweeted URLs. This combination provides a holistic view of your Twitter activity's impact on website engagement and overall online presence.
  • What is Google Analytics and how does it track Twitter traffic?

    Google Analytics is a web analytics service that tracks and reports website traffic. It tracks Twitter traffic by monitoring referrals from Twitter links. When users click on a link to your website shared on Twitter, Google Analytics records this as social traffic, categorizing it under the 'Social' channel in reports, allowing website owners to analyze the effectiveness and reach of their content on Twitter.
  • Can Google Analytics 4 Be Used With Twitter?

    Yes, Google Analytics 4 (GA4) can be used with Twitter, but with some limitations. GA4 allows you to track and analyze the traffic that comes to your website from Twitter. By adding UTM parameters to the URLs you share on Twitter, you can monitor how Twitter users engage with your website. This includes tracking page views, events, and conversions that originate from Twitter. However, GA4 does not provide direct analytics for interactions that occur within the Twitter platform itself, such as likes, retweets, or comments. The focus of GA4 in this context is on understanding the behavior of Twitter users once they arrive at your website.
  • How do I set up Twitter analysis in Google Analytics?

    To set up Twitter analysis in Google Analytics, you need to create a Twitter tracking URL, link it to your website’s Google Analytics account, and monitor the data from the Twitter Campaigns report in GA.
  • How can I use Twitter analysis data to improve my social media strategy?

    Twitter analysis data in Google Analytics can help you gain insights into which tweets, hashtags, and campaigns drive the most traffic and conversions to your website. You can use this information to optimize your social media strategy, create more effective content, and improve your marketing ROI.
  • Can I track Twitter analysis data for multiple accounts in Google Analytics?

    Yes, you can track Twitter analysis data for multiple accounts in Google Analytics by setting up separate tracking URLs and GA profiles for each account, and then comparing the data across profiles to identify trends and patterns.