With the new Universal Website tag that has been officially introduced not so long ago Twitter conversion tracking has become much easier. Previously, you would have to create a separate snippet for each event and each tailored audience. If you used Google Tag Manager for injecting those snippets, you would need to create a whole load of Custom HTML tags and triggers to cover all the conversion tracking needs. Obviously, if a certain event snippet (or snippets) contained an additional parameter, the tracking set-up could have gone to pieces.
Now tracking Twitter advertising conversions is easy since Remarketing and Conversion tracking for this traffic source has become a template tag in GTM. More than that, with the tag’s event parameters you can manage advanced conversion tracking with just a few clicks.
Here’s my step-by-step guide on how to set up Twitter conversion tracking with Google Tag Manager and how to check whether your tracking tags are operating properly.
- Set up conversion tracking
- Verify your tags
- Things to consider
Set up Twitter conversion tracking
If you’re familiar with Adwords tracking setup process via Google Tag Manager, is particularly the same. All you need to do is to a) create a tag within ads UI b) find and copy your pixel id c) paste it in appropriate field of the tag d) make the tag (or tags) fire on the events you want to track as conversions. Here are detailed instructions.
1. Generate your Universal Website tag
When in Twitter Ads UI click Tools and select Conversion Tracking, and then generate your UW tag. If you already have one, click View code and installation instructions in order to get the pixel ID which is usually placed in the following line of the snippet:
2. Create a Twitter Website tag in GTM
Log into your GTM account, choose the workspace you need and create a new tag by clicking either on the “add a new tag” link (overview section) or the “new” button (tags section).
Click on tag configuration field and choose Twitter website tag from the right-hand pane. Give your tag a descriptive name (ex. Twitter UW – Purchase).
3. Fill the necessary fields
Paste your pixel ID (step 1) in the Twitter Pixel ID field and choose the event name for the action you’d like to track. Next, you can add additional parameters to your event tag in order to set up advanced Twitter conversion tracking. You can choose whether to assign static values or dynamic values (obviously taken from your data layer) for these parameters.
Let’s say we want to track InitiateCheckout events. Naturally, we would use ‘value’, ’currency’, and ’num_items’ parameters as a minimum for this kind of events. So, here’s how the event setup could look like:
As you can see, I assigned my data layer variables for value and num_items parameters since each visitor’s cart contains different number of items and has, obviously, different value. Just because my store offers single-currency purchases, I can confidently use a static value RUR for the ‘currency’ parameter.
Here’s an example. Please mind that the following code should be placed BEFORE the GTM container snippet.
window.dataLayer = window.dataLayer || ;
'event' : 'cardDataLoaded',
'cartValue' : your_value_here,
'numCartItems' : your_number_here
As a matter of fact, you can make use of these parameters even if you want to track an event which has no particular relevance to e-commerce tracking. For instance, pdf file downloads. You can try using any “click” variable as a value for the ‘content_name’ parameter (Click ID, Click Text ect).
4. Create a trigger for your tag
For both examples above we would need to create a simple click trigger. Suppose that your “create order” button and a pdf link look like this:
// checkout button
<div id="custom-cart" class="cart clearfix">
<input type="button" value="buy" class="checkoutbtn">
// pdf link
<a class="datasheet-download" href="http://somesite.com/datasheet.pdf" title="">Datasheet_WJ128-5.0</a>
Consequently, the trigger condition would look like this:
Click Element matches CSS secelector div#custom-cart input[value=”buy”]
For pdf link:
Click Element matches CSS secelector div.product-info a.datasheet-download
To create a trigger, click on the “triggering” field, then click on “+” icon, select the desired trigger type, set up all necessary fields and options and click “Save”.
5. Preview and publish
Make sure the tag actually fires on the event you want to track as a conversion using the preview mode. If it all works well, publish the container and you are all set!
Verify your tags
Next important step is to make sure you conversion tag actually sends data to Twitter servers. Here are 3 simple ways of doing it.
1. Use browser’s network panel
You can easily verify your tags using your browser’s network panel (I’m using Chrome here). No browsers extensions or other gimmicks required.
- visit any page of your site containing the conversion tracking tag
- Click View > Developer > Developer Tools > Network (Chrome) or Tools > Web Developer > Network (Firefox)
- refresh the page
- type “Twitter” in the filter search box
You should see 2 pixels installed (t.co for mobile devices and analytics.twitter.com for desktop) if you’ve done everything correctly during the set up process. Check the Status Code says “200”
2. Use Twitter Pixel Helper
You can download this Chrome Extension from the Google Store right here. Navigate to the page with a pixel configured to fire on a certain user action and perform the action. If it all works fine, you will see the pixel fire detected by the helper.
3. Check event status in Twitter Ads UI
After you’ve implemented the conversion tracking, within the Twitter Ads you will also see the conversion events linked to the pixel event switch to a status of “TRACKING”. Please note that it may take up to 24 hours before status changes.
Things to consider
Please do mind the following when setting up Twitter conversion tracking on your site:
- Be sure to tag all necessary pages/clicks/forms etc. on your site including mobile templates, landing/promotional pages. Think of every path users may take to perform the desired action on your site and tag each step
- Use multiple tags according to the audience. This will help you to easily remarket to the desired cohort in the future.
- Test, test and yet another test before publishing – devil is in the details. One tiny mistake can lead to huge problems. Be sure to check triggering rules and dynamic values you’re using before publishing your workspace.
Once you have all the necessary data collected properly, you can start tailoring your Twitter marketing strategy according to these metrics. With great flexibility and ease provided by “Twitter WU Tag + GTM” combo you can easily deploy advanced measurement strategies and more precise targeting.