Trying to demystify the Like button as of December 2011.
http://developers.facebook.com/docs/reference/plugins/like/
Have 2 questions:
- How do I include a “src” and “ref” paramater in the URL that the user is liking? I realize this is well documented, yet I couldn’t actually do it in my testing… please provide an example of this.
- How can I stuff the UID of user that is liking it onto the link that they are liking for example, if they like http://example.com, I’d like the link to be formed http://example.com?src=fb&ref=1234567
Please point me to any examples, thanks!
I am assuming that you have the user-id.
You can specify the
refparameter as follows, (XFBML version)There is no way you can specify the src parameter, it’ll be automatically appended by Facebook, when you specify the ref parameter as shown above. The url will look like this on Facebook :
http://www.example.com/fblikepage.php?fb_ref=xyz&fb_source=profile_oneline. See the following part from the documentation.Ofcourse the fb_source parameter will vary according to where the url is shown on Facebook and that will be done by Facebook. If you want to know whether a user is visiting through Facebook or not, you can just see if the fb_source parameter is there in the
$_REQUESTvariable, something like this:Hope this helps.