Search code examples
facebookgoogle-analyticsfiddlerreferrer

how to capture the cookie param from Facebook referrer


I'm not sure about the security implications of this and if its privileged info. But I want to know if I can capture the header information from a Facebook link hitting my page. I can capture the referrer fine using $_SERVER['HTTP_REFERER'] and I get the URI. But the information is incomplete. I'm looking at fiddler2 and I want to capture the header cookie which has encoded JSON with info such as the FBID. I'm looking to build my own analytic engine, but would be happy to know if I can get this with Google analytics or a G-analytics plugin. Or maybe another way.


Solution

  • google analytics does not provide a way to do this, but a few other analytics tools out there do (for instance, Omniture SiteCatalyst).

    But as for your own home-baked solution, all headers sent to your script should show up in the $_SERVER array. For debug/dev purposes, you can look at all the headers sent by just dumping out the $_SERVER array (< pre > tags are for if you are looking at it from a browser. If you're running command-line, just do the print_r()):

    echo "<pre>";
    print_r($_SERVER);
    echo "</pre>";
    

    ...and you would simply refer to whatever header value with $_SERVER['whatever']