Search
Clear search
Close search
Google apps
Main menu

Disable cookies on a per request basis

You can disable cookies on a per request basis for Google-hosted image ads. Disabling cookies on a per request basis allows you to customize your overall use of cookies and enable per user control of them.

When you use this feature in an ad request, any cookies set on the doubleclick.net domain that are already stored in the user's browser will still be accessed and sent to Google, but they will be ignored. No new HTTP cookies will be served by the ad server on the request. Note that only Google-hosted image creatives can be served using this feature.

Cookies cannot be disabled for clicks or advertiser-facing features such as creating remarketing user lists. There is no effect on mobile device ID usage.

Disabling cookies only prevents cookies related to DFP ad serving from being used. Any other ad tags or web requests made from your site outside of DFP can result in cookies being used. For example, if you embed YouTube videos, add G+ buttons on your page, or use other such ad products on your pages, cookies will not be disabled.

The guidelines below describe how to disable cookies for different DFP tags. As with any tagging change, please be sure to verify the results are as expected after making the change.

What happens when you disable cookies

When you disable cookies for an ad request, then for that request only:

  1. All incoming cookies will be ignored. The ad server will treat the request as removed from targeted advertising and will not issue any new cookies.

  2. The following will be disabled:

    • Creative types other than Google hosted image ads, such as DoubleClick tag internal redirects or GMob internal redirects.
    • Dynamic allocation.
    • Creation of all doubleclick.net cookies.
    • Features that use cookies, including frequency capping and sequential creative rotation. Line items with these enabled will not be eligible for the ad request.
  3. Delayed impression URLs returned in response to requests with cookies disabled will also ignore cookies. Static content serving and Active View reporting are cookieless.

You cannot disable cookies for the following events or features:

  • Clicks: Cookies are not disabled on clicks. For example, if a request includes co=1 and the user clicks an ad, the user may receive a new cookie.
  • View-through conversions: If cookies are disabled on an ad impression request, DoubleClick cookies will not be included in ad impression logs. Therefore, DFP will not be able to attribute a view-through conversion even if the advertiser sent a conversion event for the ad impression.
  • Static click tracking ads: DFP does not disable cookies for static tracking, such as that used for click tracking line items. Static tracking is used for reporting clicks from ads in newsletters or mail, or ads that are served directly from the customers' web servers or media servers.
  • Conversions: Advertisers should not send conversion events to the DoubleClick ad server if the user has disabled cookies.
    Conversions might not be enabled for your network.

Google Publisher Tags (GPT)

If you're using GPT, you can disable cookies in each ad request that follows by using the following API call:

googletag.pubads().setCookieOptions(int options);

Set the options parameter to the integer value 1 to ignore cookies, and to 0 to use cookies. Learn more about setCookieOptions in the developer documentation.

To ensure the cookie options you specify take effect before any ads are requested for the page, make the setCookieOptions call the first GPT API call that your page executes. For example, you need to ensure your call to setCookieOptions is run before any call to googletag.enableServices(), googletag.pubads().display(...), and googletag.pubads().definePassback(...).display() (not an exhaustive list).

If you're using asynchronous mode, subsequent calls to refresh any ad slots (using googletag.pubads().refresh) will take into account changes made using setCookieOptions since the last request for the ad slot.

Example asynchronous GPT code snippet
<html>
<head>
<script async="async" src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script type="text/javascript">
  googletag.cmd.push(function() {
    googletag.pubads().setCookieOptions(1);
    googletag.defineSlot('/1234/travel', [728,90], 'div1').addService(googletag.pubads());
    googletag.enableServices();
  });
</script>
</head>
...
Example GPT passback code snippet
<script src='https://www.googletagservices.com/tag/js/gpt.js'>
  googletag.pubads().setCookieOptions(1).definePassback('/1234/travel', [728,90]).display();
</script>

Simple URLs

If you're using simple URLs, you can disable cookies by adding the co=[int] parameter directly to the tag request URL. You must specify the parameter early in the tag; to be safe, put it in the first 500 characters. Specify co=1 to ignore cookies or co=0 to use cookies. For example:

http://pubads.g.doubleclick.net/gampad/ad?co=1&iu=/12345/adunit&sz=728x90&c=12345

The ad server will ignore the parameter if sent for click requests using simple URLs.

Was this article helpful?
How can we improve it?