August 8, 2021
Twitter Conversion Tracking with Google Tag Manager
Updated: August 8th, 2021
If you’re already using Twitter as a marketing tool, you want to measure the results, right? You have multiple options here – remarketing, Twitter conversion tracking, etc. However, everything takes time to implement – you send an email to the developer with requirements of what should be tracked and it takes him weeks to complete the task. But not anymore! With the help of Google Tag Manager, you can speed up the process.
Before you continue
This blog post assumes you have a working knowledge of Google Tag Manager tags. If you’re a beginner, I recommend starting here. Want to be up-and-running much faster? Take a look at my GTM masterclass for beginners. The minimum requirements are:
- You have a Google Tag Manager tracking code installed on your website.
- You know what tags, triggers, variables, and dataLayer are and how they work in Google Tag Manager.
P.S. This blog post is a part of a more comprehensive guide – Google Tag Manager + Twitter, so if you’re looking for in-depth information about how to upgrade your Twitter marketing with Google Tag Manager, give it a try.
If you prefer video content, take a look at this tutorial on Twitter Pixel conversion tracking.
So What’s the Plan?
If you’re familiar with Google Ads tracking setup process via Google Tag Manager, is particularly the same. All you need to do is to:
- Create Twitter Universal Website tag in Twitter Ads account.
- Find and copy your pixel id.
- Paste it in a particular field of the tag.
- Make the tag (or tags) fire after certain interactions you want to track as conversions.
Twitter conversion tracking is closely related to remarketing. You’ll be using the same Twitter Tag Template in Google Tag Manager, but events will be different. In the blog post about Twitter Pixel, I have created a Twitter Pageview tag, in this blog post we’ll track more precise interactions, like signups or purchases.
Different types of events
For every interaction you want to track with Twitter, you’ll need to create a separate GTM Twitter tag. It will use the same Tracking ID pixel from your Universal Website tag but different tag events:
Also, triggers in Google Tag Manager will be different for each event. Want to learn various event tracking techniques? Take a look at my Google Tag Manager courses.
Purchase tracking with Twitter Pixel and Google Tag Manager
In this blog post, I will be focusing on purchase tracking (because I believe it is the most important conversion for most businesses). But the same implementation principle applies to other events as well.
The most robust option to track purchases is to ask a developer to push the purchase data to the Data Layer. Once the developer implements this, enable the GTM preview mode and make a test purchase. On the left side of the preview mode, you should see a purchase. Click it and then expand the API call. An example of that data could look something like this:
By the way, if you want to learn more about data layer and purchase tracking, take a look at this course.
Even though there are many data points (related to the purchase) in the data layer, it is completely fine to send at least the revenue and the currency. Since we want to use those two data points and send their values to Twitter Pixel, we have to create two separate Data Layer Variables.
In GTM, go to Variables > New > Data Layer Variable. Create the first variable, which is ecommerce.purchase.currency. Read this to learn more about why I entered the name like this.
Then do the same thing for ecommerce.purchase.value.
Then in GTM, go to Tags > New > Twitter Universal Website Tag and enter the following settings:
I inserted the Twitter Pixel ID constant variable (created in the 1st chapter of this blog post). Also, I have selected the Purchase event. But we are not done yet. We could also send order value and currency together with the Purchase event.
Below the list of possible events, click Add (in the Event Parameters section).
Then you will have to add two parameters (one by one). The order does not matter here so let’s start with the currency. Select it in the first field. In the second field, insert the Data Layer variable (that returns currency) that you have recently created. It will look like this:
Click Add. Then do the same thing for value. Select the value in the first dropdown field and insert the Data Layer variable that returns the order total in the second field. Eventually, the tag configuration will look like this:
In the Twitter Pixel purchase tag, click anywhere on the Triggering section and then click the Plus icon in the top-right corner.
Select the trigger type: Custom Event. If the value of the “event” parameter in the dataLayer.push was “purchase”, enter “purchase” in the trigger’s settings.
Again, I want to emphasize this. I entered “purchase” (all lowercase) because the “event” in the dataLayer.push was “purchase”. Save the trigger and it will be automatically added to the Twitter Pixel tag.
Test the setup
Now the time has come to test everything. In the top right corner of the GTM interface, click Preview.
A popup there will ask you to enter the URL which you want to test and debug. It might be the address of a homepage or it might be a specific page’s URL and then press Start.
A new browser tab (or window) should appear where you will see the URL that you entered in the previous popup. At the bottom of that page/tab, you must see the following badge:
And if you go back to the tagassistant.google.com tab, you must see this success message. Click Continue.
If you don’t see the success message or if the preview badge shows that the debugger is not connected, read this.
Make a test purchase on your website. A purchase event should appear on the Preview mode’s left side. Click it and you should see that your Twitter Purchase tag has fired.
Additionally, use the Twitter Pixel Helper Chrome extension. Refresh the page of your website where the preview mode is enabled and Twitter Pixel is activated. Click the Twitter Pixel Helper icon in your Chrome browser. You should see something like this:
Click the “Twitter website tag fired successfully” and then click Advanced Debug Info and you will see more details about the request that was sent to Twitter Pixel.
Great! Now it’s time to publish your changes in GTM. Click SUBMIT in the top right corner, select PUBLISH and CREATE VERSION, and then complete the flow that you will see there.
Things To Keep In Mind
- It may take up to 24 hours for data to appear in the Twitter Ads account (but usually it’s processed much faster).
- Before you enter tagging “rampage mode”, prepare a measurement plan – a list of what you really need to track. It will bring more transparency, help you plan ahead, and avoid inconsistency problems.
- Test, test, test before publishing – the devil is in the detail. One tiny mistake can lead to huge problems.
I will not go into details on how to set up the actual ad campaign on Twitter. You can watch this video instead.
Where can you find the sales/conversions data in the Twitter Ads interface?
You can find them by going to Campaigns > Ads Manager. Then in the list of all campaigns, switch metrics to Website Conversions. This is the place where you will find purchase data.
If you want to see other conversions, then switch back to Summary.
And click Customize metrics.
Then keep looking for Key Conversions. They are the ones that you select as your main conversions in ad campaigns.
Twitter Conversion Tracking: Final Words
Twitter conversion tracking is pretty similar to Google Ads conversion tracking in Google Tag Manager. First, you need to decide which website interactions are important to you. Then set those events within GTM as triggers (e.g. “Visited Thank You Page”) and link them to Twitter Universal Website Tags.
Remember: for every important interaction you need to create a distinct Twitter tag in Google Tag Manager.
Twitter conversion tracking enables you to measure your ad campaigns and see which ones drive more signups or sales.
Also, keep in mind that the data will not appear in real time. Be patient.