Archive for the ‘Web Services’ Category

How the facebook like button works

Friday, August 13th, 2010

I was recently working on a project involving the facebook “like” button and how it creates links back to the place of origin.  For the vast majority of websites, simply implementing the code found in the facebook documentation is enough, however, I was dealing with a different sort of monster.  The site I wanted to implement the like button on was self-replicating, using a url rewrite rule to handle replication.  To prevent duplicate content, a canonical url tag was listed in the header.  I noticed upon implementation of the facebook like button that the posted links were returning to the specified canonical url in the page header instead of the url I specified in my like tag.  This caused me to want to investigate how facebook’s like button works.  Below are my findings.

Upon clicking the “like” button, whether using the <iframe> or js SDK version of the like button, an AJAX call was sent out to facebook (of course).  Facebook would search, in this order, for the first of the following:

  1. facebook’s own open graph protocol meta tag
  2. the canonical url meta tag
  3. a specified url in the actual like button
  4. the current page’s url

Once determining the URL based on the above, facebook would then crawl the correct page sniffing for (in this order):

  1. facebook’s own open graph protocol meta tags
  2. any other data it could glean to get what it needed (ie, a meta description, the title, etc)

It would use the gathered information to then build the post on the user’s wall correctly.  However, in certain circumstances, specifying your own og tag was not enough.

In the event a user clicks the “like” button, but does not enter the optional comment, the link posted on the user’s wall actually linked back to the canonical URL.  Interestingly, the fan page that facebook creates for your page is properly linked using the og:url you specify.  We all know, however, that most users will click on the news feed link instead of the page’s.  Below are the tests I ran to verify what was happening:

canonical OG
tag
comment Finding screenshot Conclusion
YES YES YES properly linked, extra info included 1 Best case scenario but cannot force
someone to comment. OG tags will create fan pages for any page
someone “likes”.
YES YES NO Improperly linked on feed, but properly
linked in all extra info that is included (fig 1)
Note: on page refresh, it appears facebook
crawled the correct web page and added a link to the root of the site:
(still improperly linked (fig 2)
1.2.1

2. 2.2

Could get around with use of a rel param
that would be sent in url. Would require framework change to support.
YES NO YES improperly linked everywhere 3 Current implementation on live.
not acceptable
YES NO NO Improperly linked (fig 1)
Edit: on page refresh, it appears facebook
crawled the canonical index page and picked up the extra info on it
included in the canonical og tags: (still improperly linked, but extra
info from canonical page included) (fig 2)
1.4.1

2. 4.2

Current implementation on live.
not acceptable
NO YES YES Properly Linked, extra info included,
more likely to appear in news feed.
5 cannot implement—canonical must be
defined.
NO YES NO Properly Linked, with
extra info included
6 cannot implement—canonical must be
defined.
NO NO YES Properly linked, extra info
gotten from other meta tags in header
7 cannot implement—canonical must be
defined.
NO NO NO Properly Linked 8 cannot implement—canonical must be
defined.

All tests were run with the facebook javascript SDK Like button implementation method as comments are not
allowed with <iframe>s in the size we need.

Facebook has created a “rel” attribute that can be sent in with a like button, which is returned regardless of the url facebook chooses to show.  Theoretically, the issue of what page facebook posts could be gotten around with a sniffer in your code that looks for a url param of “fb_rel” and redirects accordingly.

Flixcloud to Influxis File Transfers

Wednesday, November 4th, 2009

I’ve recently been working on a project that had a user upload a video, and then that video was sent to our transcoding service, Flixcloud. After transcoding took place, Flixcloud claimed they would upload the video wherever we needed, so I had it sent to our FMS hosting provider, Influxis. Problem: the jobs were completing successfully, but my video files were not uploading to Influxis as promised. oh dear. After much back and forth between both companies, here is what we learned:

Flixcloud ONLY sends via FTP in passive mode. Influxis ONLY receives via FTP in active mode. An impasse.

Luckily, it was suggested trying SFTP. Behold! It Worked! So the next time you are using this duo for your transcoding and FMS needs, just remember to use SFTP.