Twitter Ads, while a lesser-used ad platform than the major players, still offers a respectable range of targeting and is part of many marketers’ channel strategy. As with any ad platform, properly tracking data is crucial to success.
Setting up Twitter’s tracking pixels allows you to ensure that data is flowing properly to their platform, and Google Tag Manager (GTM) helps simplify the process of setting this up. In this article, we’ll walk through creating a Twitter pixel and configuring it for your site via GTM.
Twitter offers two types of tags: a universal website tag and a single event tag. By placing the universal website tag across your site, you can then define audiences and conversion points via URL rules. You can use the single event tag for instances where you can’t isolate an event by the URL, such as tracking a form submission without a thank you page.
Creating the Universal Twitter Tag
First, let’s cover setting up the universal tag. To access the tag code within your Twitter Ads account, go to the Tools dropdown in the top navigation bar and choose Audience Manager.
On the page that appears, click “Create New Audience” and choose “Make a tag to collect website visitors” from the dropdown.
Now, you can define your audience while creating the tag. To start, we’ll make a simple “All Visitors” audience. Choose “Use a universal website tag” and check the box to agree to terms and conditions.
Now, you’ll see a page showing your website tag.
Instead of copying and pasting the whole code, you’ll want to look for the unique 5-character identifier Twitter uses for each tag. You’ll find this in the following portion of code (the area shown masked in red in the screenshot):
The portion in single quotes following ‘init’ is your Twitter ID; copy this and hang onto it for Google Tag Manager. Now, let’s move to creating your tag in GTM.
Creating the Twitter Tag in GTM
Access the GTM container for your site and create a new tag. Choose “Twitter Universal Website Tag” as the tag type.
Now, paste the unique ID you copied from the code into the “Twitter pixel ID” field. Leave “PageView” selected as the tag event.
Finally, choose “All Pages” as the trigger for your tag. Save and publish the tag live.
Within a few hours, the Twitter tag should start registering site visits. You can verify that the tag is live by visiting Tools > Conversion Tracking and checking the tag status.
Next, let’s move on to tracking a custom event in Twitter.
Creating a Custom Twitter Tag
While you can define conversions and audiences by URL rules using the universal tag, you may want to track additional events that can’t be defined using a URL. As an example, let’s set up a tag to track PDF downloads.
Go to Tools > Conversion Tracking and select “Create a New Conversion Event.” We’ll give it a unique name, choose “Download” as the type of conversion, and select “Use a single website tag.” Note that you can also choose to create a tailored audience (essentially a retargeting audience) based on users who trigger a certain event.
Finally, we’ll agree to terms and save the conversion event. You’ll be presented with a code for the event; this time, you should copy and paste the entire code.
Now, create a custom HTML tag in Google Tag Manager. (Side note: the Twitter GTM template includes custom events as options, but it appears that the manually created tag is Twitter’s preferred route for tracking events for now). Paste the custom event code from Twitter.
Finally, add a trigger for your desired action. In this case, we set up a PDF Download trigger that includes any clicks on URLs containing a .pdf extension. Save your tag, publish it in GTM, and watch the conversion data in Twitter to be sure it’s tracking properly.
Track Your Twitter Ads Performance
With GTM at your side, you can easily add Twitter pixels to your site both to create audiences and track custom conversion events. Now, it’s time to deploy your campaigns, build your audiences, and watch the data gather!
If you liked this post, you might be interested in our other posts about Google Tag Manager:
- Setting Up the LinkedIn Insight Tag with Google Tag Manager
- Setting Up Bing Ads Tracking with Google Tag Manager
- Configuring Google Analytics in Google Tag Manager
- How to Configure AdWords Tracking in Google Tag Manager
- New Integration Now Available: Facebook and Google Tag Manager
- Time To State Tracking Your Button Clicks in Google Tag Manager
What tips have you discovered for setting up Twitter pixels (or other ad platform pixels) in Google Tag Manager? Let us know in the comments below!