Conversion tracking for websites

Introduction

  • Overview
    Arrow down icon

    Conversion tracking for websites enables you to measure your return on investment by tracking the actions users take after viewing or engaging with your ads on Twitter. Twitter’s conversion tracking lets you attribute conversions beyond last link click, to include actions driven by all types of ad engagements (like link clicks, Retweets, or likes) and impressions.

    For a better understanding of the ROI of your Promoted Tweets campaigns, including the total revenue (or total conversion value) your campaign generated, and total number of items purchased, you can pass transaction values from your website into your Twitter Ads analytics. Setup conversion tracking on your website to analyze, compare, and optimize your campaigns.

    If you’ve used website tags to track online advertising on other online ad platforms, you might be familiar with the basics of how Twitter’s conversion tracking for websites functions. To start measuring conversions, you need to add a snippet of Twitter code to a page on your website that corresponds to the conversion event. We call this code snippet a website tag. On other ad platforms, the website tag is commonly referred to as a tracking script or a “pixel.”

    Twitter’s conversion tracking for websites includes powerful capabilities to let you track conversions cross-device. For example, website conversions from users who view your Promoted Tweet on their mobile device, then convert on their home computer, can be attributed to your campaign performance. Advertisers that completely integrate the Twitter Universal Website Tag across all their site pages give Twitter more touch points with their site visitors and increase the likelihood that Twitter can report accurate cross-device conversions.

  • Setup
    Arrow down icon

    The first step in setting up your campaign with Twitter Ads is to identify the conversion events you would like to track.  A conversion event could be a home page visit, a purchase, a white paper download, an email newsletter signup, etc.

    Visit the conversion tracking section of Twitter Ads, accessible via the Tools menu, to generate a Universal Website Tag code snippet for your website. After you deploy the code snippet across your site and define your conversion events URL matching, website conversions will appear within your Twitter Ads campaign dashboard.

    One website tag, two types

    The Twitter website tag can be generated for use on your website in two ways:

    • universal website tag: a single code snippet that can be placed across your entire website in order to track multiple site actions or conversions
    • single-event website tag: a unique code snippet that can be used to track a single website conversion on your website

    For most adverstisers, we recommend using the Universal Website Tag as opposed to the Single Event Tag. In rare cases you may need a Single Event Tag to track a conversion for a non-page loading event (e.g. download white paper or submit registration form). The Universal Website Tag simplifies the tagging process so you can deploy one tag across all funnel stages of your site, with a simple parameter passed into the tag to signify the type of conversion you like to track. Previously, you may have needed serveral Single Event Tags in order to collect data for various audiences.

    Create a conversion event

    Within the event details screen, you should name each conversion event you create by giving it a name you'll remember. You may want to track a general conversion event (“Newsletter sign ups” for example) and specify the URLs for each confirmation page related to that event. Alternatively, you may wish to track a more specific conversion event (“site wide purchases,” perhaps) by only specifying the URL of the confirmation page for that conversion event (URL contains: "example.com/order/confirmation").

    URL Matching

    Generally, we recommend using the 'URL Contains' match rule over the 'Exact URL' match rule. Selecting 'Exact URL' will trigger a conversion event whenever a user visits a page with a Twitter Universal Website Tag that matches your rules. This rule type looks to match the URL exactly as given, including URL query string parameters and the protocol of the page (e.g. 'http' and 'https'). URL query string parameters can vary between users and site navigation paths; therefore we recommend that you only select 'Exact URL' in very rare and specific use cases.

    If you’re using the single-event website tag to create a conversion event, you’ll need to generate a new single-event website tag code snippet for each new conversion event (maximum of 25). Each code snippet must then be placed on the webpage where the conversion event is completed.

    Post-engagement attribution window

    Select the time window for crediting Twitter with conversions that happen after a person engages with your ads. Some examples of a user engaging with your ads can include likes, Retweets, follows, @replys, or URL clicks on your Promoted Tweet. The options for post-engagement attribution windows are 1, 2, 3, 5, 7, 14, 30, 60, and 90 days. If you’re not sure what window to select, we recommend the default setting of 14 days. If you change this setting your conversion data will be retroactively updated, so feel free to come back later and experiment with different attribution windows.

    Post-view attribution window

    “Post-view” refers to when a Twitter user sees your Promoted Tweet and does not engage with it, but later visits your website and converts. Users often see, read, and view media in your Promoted Tweets without clicking on them — including post-view attribution gives you insight into conversions you received but weren’t actually charged an engagement for. The options for post-view attribution windows are none, 1, 2, 3, 5, 7, 14, 30, 60, and 90 days. If you’re not sure which setting to choose, we recommend the default of “1 day after view.”


    Copy and paste your website tag into your site

    After you generate the code snippet for your website tag, you need to put the code snippet on the page you would like to track. The code snippet should be pasted just before the closing HTML </body> tag of your web page, or inside a container tag or tag management system. You might need a developer or technical resource to help you implement it. Please see third party tracking tools section below for step by step instructions on tag management systems.

  • Conversion types explained
    Arrow down icon

    A conversion event can be any "Action" that a user completes on your site which you would like to track. It does not have to be a purchase, but can also be a shopping cart update, a newsletter sign up, etc. Choose the type of conversion you’d like to track with this tag. Available tag types are Site Visit, Purchase, Sign Up, Download, or Custom.  Choose “Custom” if you’re tracking an action other than the conversion events we’ve predefined. Your Twitter ads dashboard reports on conversions by conversion type.

    Note: In almost all cases, a particular conversion type should only be used once on your website. Creating several conversion events of the same conversion type can lead to duplicate data in the Twitter Ads Dashboard.

    Site visit: User visits your site

    Purchase: User completes a purchase of a product or service on your site

    Download: User downloads a file, such as a white paper or software package, from your site

    Sign up: User signs up for your service, newsletter, or email communication

    Custom: This is a catch-all category for a custom action that does not fall into one of the categories above

     

  • How can I use conversion tracking to improve my campaigns?
    Arrow down icon

    Building great direct response campaigns on Twitter Ads is all about testing different strategies, measuring what works most effectively, and doubling down by creating more campaigns similar to the successful ones. Continue this cycle until you’re happy with the the cost per action (CPA) you’re seeing from your Twitter Ads. Most successful advertisers go through this cycle regularly to make sure their campaigns are fully optimized:

    • Create a conversion event specifically for the conversion you’d like to track. These can be generic (website visits, lead form submissions, site wide purchases) or specific (Ticket sales for Friday’s art show).
    • #protip: Create conversion events for different parts of your conversion funnel. For example, create a Site Visit conversion event for your product landing page, and a separate Purchases conversion event for your checkout confirmation page. This gives you insight into how well traffic from Twitter is converting once they get to your site.
    • Build a few great direct response Promoted Tweet campaigns to drive customers to the right spot on your website.
      • Make sure your Tweet copy is tightly focused on driving the conversion
      • Make sure your targeting matches potential customers (e.g. website visitors through web tailored audience).
      • Test variations on Tweet copy and targeting across multiple different campaigns. The more things you try, the sooner you’ll find the key to driving action from your customers on Twitter.
    • Monitor your campaign analytics to discover which campaigns are driving the most conversions at the lowest price (CPA). Allocate more of your budget to these successful campaigns and try creating more campaigns similar to them.

    In addition to following this cycle of optimization, implementing these best practices can help you drive the most value out of conversion tracking:

    • Have a target CPA in mind. This will help you optimize toward a goal and identify which campaigns are working and which need improvements.

    • You can track conversions at both the campaign and the Tweet level. Use this to dig in to which Tweet copy is working best for you to make even more granular optimizations.

    • Website tags can be used across multiple campaigns. No need to create new website tags for each campaign you run.

  • How to verify website tags are tracking?
    Arrow down icon

    Option 1: Once you’ve placed the website tag code, return to the Conversions tab in Twitter Ads. You can verify the status of your website tag by finding the tag within the “Conversions” tab in ads.twitter.com.

    There are three different status types for tags:

    • Tracking: Twitter has gotten pings from the tag within the last 24 hours

    • Unverified: Twitter has not gotten any pings from the tag yet

    • Inactive: Twitter has not gotten any pings from the tag in the last 24 hours

    Option 2: To further debug your conversion tracking setup, consider using our Twitter Pixel Helper Chrome extension. This extension will allow you to quickly see whether the Twitter tag is firing on a particular page and if so, what parameters are being sent to Twitter.

    Option 3: Your tag begins sending data to the Twitter Ads UI the first time someone visits your tagged web page. Your tag doesn’t need to be "tracking" in our UI to collect data, but if you are experiencing problems with your tag or you just want to be thorough. Do the following steps to explore the code from your site and verify that your website tag is placed and working properly.

    Using Google Chrome

    1. Go to the drop down menu on Chrome: View, Developer, Developer Tools

    2. Click on Network Tab

    3. Type "Twitter" in filter search box and refresh page

    4. Look for Twitter conversion tags, and match the pixel ID to above ID from our Ads UI

    5. Check that it is a conversion tag. It should look exactly like the syntax in the Ads UI

    6. Check if if the status column says "200"

    7. Check that there are two pixels installed, one is for desktop and the other is t.co for mobile

    8. Container tags should show up too

    Using Mozilla Firefox

    1. Go to drop down menu on Firefox: Tools, Web Developer, Network

    2. Sort by "Domain" and refresh the page

    3. Scroll down and look for "analytics.twitter.com" and "t.co"

    4. Look for Twitter conversion tags, and match the pixel ID to above ID from our Ads UI

    5. Check that it is conversion tags, it should look exactly like the syntax in the Ads UI

    6. Check if the status column says "200"

    7. Check that there are two pixels installed, one is for desktop and the other one is t.co for mobile

    8. Container tags should appear as well

  • How to setup advanced conversion tracking to monitor campaign ROI?
    Arrow down icon

    Your website tag can also be used to gain an understanding of the ROI of your Promoted Tweets campaigns, including total revenue (or total conversion value) your campaign generated, and total number of items purchased.

    Conversion tracking automatically logs traffic and the path someone takes through your tagged pages, but to record how much someone is spending or the amount they’re buying, you need to apply the proper tag event type and attribute values to your base code. In this instance you’ll want to use the “Purchase” tag event type:

    Universal website tag purchase code
              <!-- Twitter universal website tag code -->
    <script>
    !function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
    },s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='//static.ads-twitter.com/uwt.js',
    a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
    // Insert Twitter Pixel ID and Standard Event data below
    twq('init','twitter_pixel_id');
    twq('track','Purchase', {
        //required parameters
        value: '29.95',
        currency: 'USD',
        num_items: '3',
        //optional parameters
        content_ids: ['sku-1234','sku-5678','sku-ABC'],
        content_type: 'product',
        content_name: 'Content name',
        order_id: 'ORDER-676546-B'
    });
    </script>
    <!-- End Twitter universal website tag code -->
          

    Parameters:

    • value (required) refers to the actual value of the item or action's conversion being tracked.
    • num_items (required) reflects the number of items purchased for the conversion, for most hardcoded implementations this value will be '1'.
    • order_id (optional - nice to have) refers to the order or purchase identification number generated for the conversion.
    • content_ids (optional) refers to the either the product SKUs or product group IDs you are passing.
    • content_type (optional) should reflect the type of content_ids being passed. For instance, if you are sending product ids then you should write in “product”, if you are sending product group ids then enter “product_group.”
    • content_name (optional) refers to the name of the page or product.

    At a minimum, you must define ‘value’, ‘currency’, ‘num_items’ for the purchase tag event type. If you are not in the United States, or are using a currency other than the United States Dollar, you’ll need to replace ‘USD’ with the abbreviation of the local currency.

  • Analytics for website conversion tracking
    Arrow down icon

    Once you’ve set up a website tag, reporting for website conversion tracking is available on the Campaigns tab. You’ll see the number of conversions driven at the campaign or tweet level, as well as related metrics such as impressions, engagements, and spend, and CPA. You can see specific charting for conversion information under a new tab called conversion metrics, with analytics also available via a downloadable csv on that same page.

    The campaign dashboard will show conversions by conversion type. So, for example, if you are interested in tracking two different types of purchases you may want to set one up as “purchase” tag and the other as a “custom” tag to report on the two separately. The downloadable csv offers post-view and post-engagement conversions broken out separately. The conversions are combined on the conversion metrics view. If you chose to pass back transaction values, total sales and order total quantity will be reported in the campaign dashboard under the conversions tab.

  • What is Tailored audiences from Web?
    Arrow down icon

    Tailored audiences from the Website tag enables you to reach Twitter users who recently expressed interest in your products by visiting your website. Tailored audiences from Web uses the same website tag for conversion tracking from this page. For more information on how to use this, please see the Tailored audiences from Web page.

    *For website clicks or conversion campaigns, better performance is seen when the web site visitors tailored audience is used in targeting.

  • Content Security Policy details
    Arrow down icon

    We have added a 302 redirect rule for our Online Conversion Tracking Tag (oct.js) and Universal Conversion Tracking tag (uwt.js). The redirect works as follows:

    https://platform.twitter.com/oct.js ==> https://static.ads-twitter.com/oct.js

    https://platform.twitter.com/uwt.js ==> https://static.ads-twitter.com/uwt.js

    If you have a website that has a rigid Content Security Policy (CSP), please add ads-twitter.com to it.

Third-party tracking tools

  • Google Tag Manager
    Arrow down icon

    1) Log into your Google Tag Manager account: https://tagmanager.google.com/#/home

    2) Select the appropriate Workspace associated with your website’s container.

    3) Select “Tags” from the left-hand navigation menu and click “Add A Tag”.

    4) When prompted, select “Choose a tag type to begin setup…”. From the right-hand pane, select “Twitter Website Tag” from the list.

    5) Give your tag a title or else it will default to “Untitled Tag”.

    6) Within the Twitter Ads UI (ads.twitter.com), log into your Ads account and click Tools > Conversion tracking.

    7) If prompted, generate your new Universal Website Tag. Otherwise, click “View code and installation instructions”.

    8) Within the code snippet, copy your pixel ID from the line that resembles “twq(‘init’,‘twitter_pixel_id’);”. In the screenshot below, the pixel ID is ‘nuqtg’. Your pixel ID will be unique to your Ads account.

    9) Within the Google Tag Manager form, paste your pixel ID in the Twitter Pixel ID field.

    10) Select the appropriate Twitter tag event for the action you wish to track on your website.

    11) Add the necessary parameters for the tag event. Assign static values or dynamic values from your data layer for each tag parameter. For example, the “Purchase” tag event will typically include “value” and “currency” parameters:

    12) Add the necessary triggers to have the tag event load on a specific set of web pages. For example, the “Purchase” event typically fires on order confirmation pages, so our example tag trigger only loads the tag when “purchase” is within the page URL (Your triggers will be specific to your site configuration and URL structure):

    13) Complete similar steps for all stages of the site, e.g. do not fire 'PageView' tag event when the 'Purchase' tag event fires.

  • Tealium
    Arrow down icon

    1) From your Tealium dashboard, click the “Tags” tab and then click “+ Add Tag”.

    2) Search for the Twitter Universal Website Tag, then click “+ Add”.

    3) Give your tag a title. It will default to “Twitter Universal Website Tag”.

    4) Within the Twitter Ads UI (ads.twitter.com), log into your Ads account and click Tools > Conversion tracking.

    5) If prompted, generate your new Universal Website Tag. Otherwise, click “View code and installation instructions”.

    6) Within the code snippet, copy your pixel ID from the line that resembles “twq(‘init’, ‘twitter_pixel_id’);”. In the screenshot below, the pixel ID is ‘nuqtg’. Your pixel ID will be unique to your Ads account.

    7) Within the Tealium UI, paste your pixel ID in the Twitter Pixel ID field.

    8) Set your “Load Rules” to appropriately load the tag on the relevant pages of your website. Load Rules determine when and where to load an instance of this Tag on your site. The 'Load on All Pages' rule is the default. To load the tag on a specific page, create relevant conditions to apply to the configuration.

    9) Set your “Data Mappings”. Mapping is the process of sending data from a data source, in your Data Layer, to the matching destination variable in the Twitter Universal Website Tag.

    Below is an example of a set of data mappings for this tag. Your Data Source names do not need to match the example. This example assumes a fully configured E-Commerce extension.

    10) Click “Publish” in the Tealium UI to publish the newly created tags to your development, staging, or production environments.

    Note: If you have any questions please see Tealium’s detailed documentation here: https://community.tealiumiq.com/t5/Tags/Twitter-Universal-Website-Tag-Basic-Configuration-and-Data/ta-p/15214

  • TagMan by Ensighten
    Arrow down icon

    1) From your TagMan dashboard, search for the “Twitter Universal Website Tag” within the TagMan library:

    2) Give your tag a title. It will default to “Twitter Website Event Tag”.

    3) Within the Twitter Ads UI (ads.twitter.com), log into your Ads account and click Tools > Conversion tracking.

    4) If prompted, generate your new Universal Website Tag. Otherwise, click “View code and installation instructions”.

    5) Within the code snippet, copy your pixel ID from the line that resembles “twq(‘init’, ‘twitter_pixel_id’);”. In the screenshot below, the pixel ID is ‘nuqtg’. Your pixel ID will be unique to your Ads account.

    6) Within the TagMan UI, paste your pixel ID in the Twitter Website Tag ID field.

    7) Set the “Tag Event Type” field to one of the Twitter tag event types. Example: PageView, ViewContent, Search, AddToCart, AddToWishlist, InitiateCheckout, AddPaymentInfo, Purchase, Signup, CompleteRegistration, or Download.

    8) Depending on your selected “Tag Event Type”, configure the necessary parameters for the event.

    Note: Each Twitter tag event has a set of required and optional parameters. For example, the “ViewContent” event requires the “content_ids” and “content_type” parameters.

    9) Configure the tag firing conditions for the tag event type.

    10) Save the configuration and repeat the above steps for each tag event you wish to fire on your website.

    11) Publish the newly created tags to your development, staging, or production environments.

  • Signal
    Arrow down icon

    1) Log in into Signal account here.

    2) Click on “Tags” -> “Add a Tag” -> Search for “Twitter Conversion” -> preferably choose “Twitter Universal Website Tag (JavaScript)”

    3) Setup PageView tag for tracking all site visits: (conditionally fire everywhere except purchase / checkout)

    4) Assign inputs to where the tag is executed (all pages except checkout).

    5) Create a second tag to track purchase conversions (if applicable).

    6) Assign inputs to where the tag is executed (purchase / checkout).


Did we help answer your question?

The maximum length for this field is 5000 characters.
Success
Thanks for submitting feedback on this article!
Error
Problem sending form.

Visit Twitter Ads