Streaming: Cookies do not Persist

Last Updated -

This article is for: publisher technicians/developers.
Using: Tap and/or a2x in cookie-based players.
Problem: Web cookies do not persist during a session.


The cookie-sync process is used to make sure a unique and reusable cookie for every ad call within a session and for all sessions with the same browser (until such time as cookies are cleared by the user). If you find that cookies are not persisting from session to session, or even within the same session, the list of possible problems below might provide some insight to help you troubleshoot the problem.

User-driven Blocking Tactics are Being Used

The user might be using Private/Incognito mode in their browser, or might be clearing their cookies. They might have enabled "Do Not Track" or they might have installed an ad or cookie blocker.

In these cases there is not much you can do; lack of cookie persistence is normal behavior when these user-driven tools are used. But as long as a cookie is being set, even temporarily for the session, it will still function properly and will be used for frequency capping. In the case of ad blockers and cookie blockers, they completely disable the setting of cookies, so it is normal that you don't see any cookies being set.

The Web Application Uses Ajax/ XHR /JQuery or Other Frameworks

You might have integrated the cookie sync or parts of your code inside a framework; this can interfere with the cookie sync process unless extra steps are taken to make it work. XHR for example, uses the concept of "credentials" to store cookie data, and without the proper settings it is possible your code simply does not store and forward any credentials (More information here).

It is possible you might need to adapt the cookie sync process to your particular framework; you can do this as long as the end result is the same as the normal cookie sync process. Please refer to your framework documentation on how to handle cookies.

To validate a modified in-framework cookie sync, start by integrating the cookie sync on a simple page with no framework. The browser should act normally and set and return the persistent cookie. Then compare with your integration with the framework and see if you get the same result. If you do not get the same result you will need to troubleshoot your framework integration until it works.

Mobile Web Usage

iOS and Android act differently from each other, and different browsers act differently on each of these operating systems. Also, it is possible that a user-initiated setting like "Limit advertising tracking" will prevent cookies from functioning properly in mobile browsers.

For this reason we recommend you use a native application for mobile, because native applications typically don't use cookies and the cookie-sync process; they use the native Advertising Identifier.