How do ads follow you from one website to another

Just the other day I was browsing a pair of sneakers on an e-commerce website. I had not finalized on a pair and turned off my laptop only to find great deals on sneakers from other websites I browsed, on my phone or the tablet. The ads were relevant and kept following me from one web page to another until I finally gave in and took the plunge. The technical term for what just happened is “Ad Remarketing”. It has emerged one of the most effective strategies for conversions on the internet and we users have been remarketed some day or the other while going on with out daily internet activities i.e. reading news, browsing through social media or generally searching for any information. I will try to break down how Ad Remarketing broadly works from a technical perspective as far as Google Ad Words are concerned, in this post.


Google and facebook are two companies at the fore-front of advertising network with billions of users every day. Google caters to both buyers and sellers through two major programs i.e. Ad Words and Ad Sense. Ad Words let you bid on words, create campaigns and place them on two kinds of networks i.e. a search network which means the space on top and bottom of results from a google search and a display network which encompasses a plethora of websites or apps that have partnered with google and agreed to have these ads placed on their space and earn revenue out of it. Google being the intermediary provides all the necessary infrastructure to display those ads at relevant spaces to relevant users at the right time thereby completing the cycle of engagement. Its a win win for everyone and Google makes a ton of money in the bargain.


Ad Remarketing is a special kind of ad campaign that lets a website target its past visitors by showing them the products they browsed or other related products that similar people bought.

Google Ad Remarketing infograph

Google Ad Remarketing infograph


Basic steps involved in a remarketing set-up:

  • Create an ad campaign and pick the right network for displaying those ads i.e. search or display network.
  • Generate and add a remarketing tag to your website. Just like adding Google Analytics, adding a remarketing tag is quite similar. You need to add a small snippet of javascript that uniquely identifies your website and connects it to the relevant ad campaign defined on the google network through the  google_conversion_id .

From Google Ad Remarketing documentation:

The type of remarketing that you are doing will depend on your business strategy.

Static remarketing is a straightforward approach that tends to rely on the pages that visitors have got to – for example if a visitor has reached a particular page on your site you may want to show them a static ad encouraging them to return and continue.

Dynamic remarketing offers greater flexibility by providing more information and can use both static and dynamic ads – for example if you know the value of a visitor’s abandoned basket you could decide to show a static ad only to visitors whose abandoned basket was over $50 in value and ignore those visitors where the value was less than $50. These rules can be configured within AdWords and are made possible by providing additional information in the google_tag_params


  • Once the remarketing tag is configured correctly on the website, to accommodate dynamic remarketing, we need to add support for the custom parameters used in  google_tag_params or use some predefined parameters that google provides for specific businesses listed here. This step is analogous to defining our vocabulary so that google knows what product(s) to show in the ad banners for returning users.
  • Campaigners can then create remarketing lists so that users are added to remarketing lists as per specific rules or products that they browse on the website and custom lists can be defined.
  • As soon as you browse a product on a website with remarketing enabled, cookies get created on our browsers to persist such information i.e. the product(s) we browsed, the remarketing tags etc. The added remarketing snippet sends this information periodically to Google networks and they run massive computations on modeled users and find similar audiences for the product.
  • As soon as we then move to another website that has partnered with Google through the Ad sense program, the profiled user is matched with such similar audience lists from millions of other websites and google curates all the ads relevant to users based on factors like recency, prior interest and ranks them and we see the top ranked ad in the banner. A little detailed primer on finding similar audience can be found on this article.


Closing thoughts –

My initial motivation behind sharing this information was to understand how remarketing works. Since I am not a product guy myself, a lot of these terms were new to me and I felt other websites like facebook rely on a similar scheme too as far as a high level front end api is concerned. What surprised me was the sheer number of digital marketing companies banking on these technologies already served to us by google and facebook and making a business on top of them. Here’s a quick run down on how you can make your own ad-remarketing service:

  • Set up your google adwords or facebook campaign and remarketing tags which you will manage for all the clients
  • Create apis for syncing custom parameters or product definitions of the clients to the central google adwords account you are managing
  • Provide an api (easily in line with the google remarketing api structure) and ask the client to provide those custom parameters for products that need to be tracked. If the remarketing is static, a simple  iframe  will do the trick and will make sure your servers recive an api request on a every new page visit with all the info. You can then make custom requests to google adwords network from your backend and do any analysis on the data. If the remarketing is dynamic you will have to provide some custom javascript to your client ensuring that the correct custom parameters are passed to your api call. And you are done. I won’t expound on it further. But it will be a good exercise to go to any travel or hotel website and explore the api calls and cookies for a lil bit. You will stumble upon remarketing tags quite soon 😉