C#C
C#3y ago
Knuceles

✅ Google Analytics Cookies

So I learned that google analytic cookies (identified as _ga, _gid, AMP_Token for name pairs) are generated from client-side from analytics.js. So if I open a browser, and visit a site that uses google analytics, I could find those cookies easily.

I want to try implementing a C# program that could obtain those cookies. If I were to send an HTTPWebrequest, and inspect cookies, I believe only the server-side generated cookies show. So how would I see client-side generated cookies?

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URL);

req.CookieContainer = new CookieContainer();
using (var response = (HttpWebResponse)req.GetResponse())
{
  Console.WriteLine(response.Cookies);
}
Was this page helpful?