Advanced conversion tracking

Conversion pixel and tracking purchases

After becoming familiar with conversion tracking set up, use this page to learn more about the technical aspects of conversion tracking.

The conversion “pixel” or “tag” that we generate is a few lines of Javascript. You’ll place this code as high up in the HTML of any pages you want to track, within the <html> element. The tag can also be placed within the <head> element of your page if necessary.

Only pages that have a Twitter website tag (the code you generated) will be tracked. You should create a tag for each page.

Overview

  • Creating the Purchase tag event type
    Arrow down icon

    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:

    Be sure to replace the pricing entered after “value” with the actual value of the item whose conversion you are tracking. The “num_items” parameter reflects the number of items purchased for the conversion, for most hardcoded implementations this value will be ‘1’. 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. “content_ids” refers to the either the product SKUs or product group IDs you are passing. The “content_type” should reflect the content_ids being passed. For instance, if you are sending product ids for “content_ids” then you should write in “product”, if you are sending product group ids then enter “product_group.”

    You may also add “content_name” and “order_id” as parameters if you wish to track more product details. Where “content_name” refers to the name of the page or product, and “order_id” is the order or purchase identification number generated for the conversion.

    At a minimum, you must define ‘value’, ‘currency’, ‘content_type’, and ‘content_ids’ for the purchase tag event type.

     

  • How to pass dynamic values
    Arrow down icon

    The Purchase tag type can pass the same value when an action takes place, or a “dynamic transaction” that records changing figures:

    • Hardcoded conversions are helpful if you’d like to record the same value each time. For example, if you’ve decided that someone signing up to your email list yields a value of $9.99 to your company, a hardcoded conversion could be placed on your “Thank you for signing-up!” page to record $9.99 for every sign-up.

    • Dynamic transactions should be used when you don’t want a predetermined value assigned to each conversion. For example, if you define a conversion as a purchase and an individual’s total is $53.72, a dynamic transaction would report that amount in your Twitter Ads account. To enable this feature, you’ll need a developer to create the code or parameter that you’ll place in the “value” or “num_items” sections of the website tag’s code.

  • Third-party tracking tools
    Arrow down icon

    We support the following third-party container tags:

    • Floodlight tags (e.x., Google Tag Manager, DoubleClick for Advertisers)

    • Universal action tags (e.x., Atlas)

    • Server-direct (“tagless”) integration with Signal

    If you would like to learn the amount or quantity of the transactions taking place on your site and are using third-party tracking, you will use the same code you created in order to tag your pages:

     

  • How to verify website tags
    Arrow down icon

    Your tag begins sending data to ads.twitter.com the first time someone visits your tagged web page. Your tag doesn’t need to be activated to collect data, but if you are experiencing problems with your tag or you just want to be thorough — the easiest way to verify your tag installation is by downloading our Chrome extension at ads.twitter.com. You can also use 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 isntalled, 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
  • 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.


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