Web Page Coding

The retargeting code can be implemented by your advertisers on their web site in order to tag visitors with segments so that you can later retarget campaigns to them. However, this is only required if they wish to track events other than a view, click or action. In cases where you have no requirement for extended tracking you can instead use the Visitor Tagging feature when creating/editing a campaign to automatically tag visitors with segments when viewing, clicking or performing an action on your campaigns. Often times it’s difficult or impossible for advertisers to place retargeting pixel code on their web site, so by using this feature you can avoid that hurdle by completely eliminating the need for a pixel.


In most cases you will want to tag visitors multiple times as they view different pages on your advertisers web site. This is accomplished by creating segments to represent pages or actions the visitors might perform. To manage segments, go to Settings > Segments where you can create/edit/delete segments. Alternatively you can create new segments when generating Retargeting Code with the Code Wizard, which is generally much faster.

The retargeting code does not visibly display anything in the page. It simply makes HTTP/HTTPS request to tag visitors with segments, which uses cookies and looks like this:

<script type="text/javascript" src="http://adserver.example.com/servlet/retargeting?aid=123&javascript=true&segments=DKA1PXOI3CCWAPUI"></script>

As you can see the segment tagged by this retargeting code is DKA1PXOI3CCWAPUI. This is an alias for the segment. By default a random alias is generated for every segment. You can, however, choose to create more human readable aliases if desired.

When creating segments you can also specify a timeout for them, which allows you to expire them after tagging visitors with them after a certain period of time.

Usage Examples

As is mentioned above, in most cases you will probably want to create several segments for each of your advertisers. For example, you might create separate segments for their landing/product pages, order form and order confirmation page. This basically allows you to tag visitors at each step of the purchasing process and gives you a lot of flexibility to retarget campaigns to them.

Retargeting Casual Visitors

What if the advertiser only wants to retarget visitors that haven’t already placed an order? You simply target the landing page and order form segments while blocking the order confirmation segment. This way you only retarget visitors that viewed the landing page or order form, but you exclude those visitors that placed an order.

Retargeting for Repeat Purchases

Maybe the product that was ordered only lasts for a certain period of time and needs to be purchased regularly? An example would be cleaning products. The advertiser might want to retarget visitors that purchased over two weeks ago in that case. To accomplish this you simply set the timeout for the order confirmation segment to two weeks, which causes it to expire two weeks after the order is placed. The actual retargeting setup for the campaign is the same with the landing page and order form segments being targeted and the order confirmation segment being blocked.

Retargeting Abandoned Carts

How about shopping cart abandonment? It’s a good idea to try and get back those visitors who put something in their shopping cart but didn’t complete a purchase. You can accomplish this by targeting only the order form segment and blocking the order confirmation segment. This is good if you want to give a more direct message to these visitors. For example, the banner might offer them a discount or some other incentive to entice them.

Advanced Usage

Piggyback Pixels

The retargeting pixel supports piggybacking to enable third-party retargeting without requiring the advertiser to implement additional coding. If you are using JavaScript pixels you can actually piggyback an unlimited number of pixels. However, if you are using a more traditional <IMG> tag pixel you will be limited to a single piggyback pixel. This is because <IMG> tag piggybacking must be implemented with a HTTP redirect.

To set up a piggyback pixel you will need to go through the following steps assuming you have already placed a retargeting code on an advertisers web site:

  1. Go to Settings > Pixels
  2. Create a new JavaScript or Image pixel depending on the advertisers requirements
  3. Go to Accounts > Advertisers
  4. Edit the advertisers account
  5. Select the pixel you created as the Retargeting Pixel in the Piggyback Pixels section

Once you have completed these steps you piggyback pixel(s) will automatically be tied to any retargeting codes for this advertiser.

Alternatively you can set a piggyback pixel on the segment(s) that are being logged by the retargeting code. This offers a lot more flexibility. In fact it’s absolutely necessary if you’re trying to match up many different third-party segments with your own segments.

You might wonder why this process is not tied into the code wizard? The reason is that you might not have the piggyback pixel up front or you might want to remove it later. By decoupling this process from the code wizard you can perform either of those tasks without the advertiser needing to update their retargeting code, which is often a painful process as advertisers are usually unwilling or slow to change coding.