I need to create a list of cookies and their sources. Is there any way to understand from which script particular cookie comes from? For example, '_ga' cookie is definitely set by some of the google analytics script, but is it possible to identify which script exactly?
For Google Chrome go to View > Developer > Developer Tools or CMD + ALT + I on Mac or F12 on Windows. Now open the Application tab and check the cookies for each domain.
A quick primer: cookies and scripts Cookies can be useful for things like recording if a user has logged into a website or not. To find out more about cookies, visit www.allaboutcookies.org. Scripts are small computer programs embedded within web pages that give those pages extra functionality.
An HTTP cookie (web cookie, browser cookie) is a small piece of data that a server sends to a user's web browser. The browser may store the cookie and send it back to the same server with later requests.
Cookies are usually set by a web-server using the response Set-Cookie HTTP-header. Then, the browser automatically adds them to (almost) every request to the same domain using the Cookie HTTP-header.
Some of the cookies are set by ajax-responses (you can find such cookies in Chrome Dev Tools -> Network tab and make a search with string 'set-cookie:').
As for the rest, I took a code snippet from here Breaking JavaScript execution always when cookie is set but instead of debugging I'm calling console.trace() function, which actually shows functions and their sources. That's it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With