Facebook Meta Tags for Drupal

I was having trouble getting Facebook “Likes” and Facebook “Shares” to properly pickup my page summaries any time someone would “Like” or “Share” a page.  Instead of picking up the first few sentences of text from the page, Facebook was picking up my Adsense code – showing (Adsense code) jibberish on people’s Facebook Wall any time they shared one of my pages.  Facebook was also picking up the wrong images to display with the “Share”.

After 3 minutes of research and by using the Facebook Debugger Tool (VERY helpful!) I found that the Facebook crawler was confused by my lack of Open Graph (OG:) Meta tags.  I was using the Facebook Social Drupal Module but it only provides the bare minimum Open Graph meta tags for Shares and Facebook “Likes”.

For getting these additional Facebook meta tags, I found the Drupal Open Graph Meta Tags Module.

This module makes it easy to add Open Graph meta tags (http://opengraphprotocol.org/) to a node to enable it to be come a “rich” social object. For instance, Facebook uses this information to work out how to preview shared content in a user’s Facebook profile (http://developers.facebook.com/docs/share).

This module makes it easy to select the image thumbnail used to represent the node (used by Facebook when constructing a preview). The editor is shown a list of thumbnails of all images associated with the node (both as fields as well as images embedded within the node’s body content).

If need be, meta tags can be restricted to specific content types and access to administering and editing meta tags can be restricted by role using Drupal’s built-in permissions system.

After getting your Open Graph meta tags configured, you may notice that when Sharing or Like-ing pages, Facebook is still not seeing your tags – this is because the Facebook crawler has the old page cached.  You can force the Facebook crawler to re-crawl your page and update it’s cache by using the Facebook Debugger Tool.  Just enter the URL and hit the DEBUG button, and the Facebook crawler / bot will recrawl your page and update the Facebook cache.

Cootsinnovationregister .. Yah.. Cootsinnovationregister !

Crazy FaceAfter what I thought was a flawless Drupal integration with Facebook, after a day or two I ran into one problem: Cootsinnovationregister

For some reason, when visitors did a Facebook “Like” or “Share” on some pages, instead of posting the page title and description to their Facebook wall, only the word “Cootsinnovationregister” would be posted. Google turned up very few results for the word Cootsinnovationregister, and it certainly had no obvious meaning to me.

After a little troubleshooting with the Facebook Linter tool, I was able to narrow down and resolve the problem. It seems that with Mod_Security enabled, Cootsinnovationregister was being returned as the Page Title and Description. There was no mention in the Mod_Security logs, and I don’t know if the ‘Cootsinnovationregister’ string is particular to just my site or all sites/servers using Mod_Security – but if you are having the same problem and came here via Googling “Cootsinnovationregister”, here is the fix: Whitelist all of Facebook IP’s in Mod_Security and Facebook will then be able to correctly access and read your webpages, titles, and page descriptions – no more Cootsinnovationregister! If you have trouble getting the Facebook server IP’s (there are several!) hit me up via my contact page or on my Facebook page, and I will be happy to send you the entire list.

UPDATE: After much obsession and digging, I finally found the real cause of this issue: We have a custom Mod_security rule that detects a specific kind of invalid header. Because this type of invalid header configuration is a common trait of spammers and because so many bots hit the server with this type of header, all logging and auditing was disabled. Instead of blocking requests with this invalid header, we re-direct them to our HoneyPot.. Which has a page title of, you guessed it, “cootsinnovationregister”.. It turns out that the Facebook servers also have this ‘invalid header’ and were getting redirected to the honeypot. Because we already had some of the Facebook servers whitelisted, but not all of them, the issue was intermittent.

Chances are you will never see this issue with the specific wording that I was seeing, but it is possible that you would see something similar – Facebook pulling incorrect page titles and descriptions..

Drupal: Integrating Your Site With Facebook

After avoiding it for years, I’ve finally added some Facebook integration with the website. I don’t know why I avoided Facebook this long. I’m not sure if thought Facebook was just a ‘fad’ or I just didn’t think it would help in any way or maybe I thought that the integration would be too difficult. So far it turns out I was wrong on just about all counts.

It’s fairly easy to integrate things like Facebook “Like” buttons, “Facepiles”, etc. There are several Drupal Modules for Facebook to choose from. Which one you decide on depends on what you want to do, and compatibility with your existing modules – I started with the Facebook Social plugins integration module which is pretty simple to setup and gives you instructions for creating your Facebook App ID, etc. I had Facebook Social plugins up and running in just a few minutes – so much for being difficult.

It’s hardly been 48 hours since I built a “Facebook Page” for the website, and we’ve already gotten a few “likes”. Also, by adding the Facebook “Like” button to all of our pages I am now able to see how many times those pages had been ‘shared’ or “liked” over the years. I was shocked to see many pages that had been shared or liked hundreds of times! Facebook also has a great little analytics package called “Insights“, that once setup provides a webmaster with some startling demographics information about the people visiting your page.

 

Perhaps the most surprising of all are the results of the Facebook advertising campaign I setup. I was able to buy a CPM ad for only a few cents per 1,000 views. Even more surprising is that according to Adsense & Google Analytics, the CTR and earnings for visitors coming from Facebook is incredibility high! Man.. I was really wrong about that one..

As far as Facebook being a ‘fad’.. This is the one I was most wrong about. Over 600million Facebook members and still growing proves me more wrong every day!

If you haven’t setup a Facebook presence or at least tried/testing running a Facebook ad campaign I recommend you give it a try. You can see/follow/”Like” our new Facebook page (above) or my “public” Facebook profile (using my middle name instead of last name) here:

My Personal Page |

..

Slightly New Look To The Blog

Longtime readers that are paying close attention may notice a few minor changes and a slight new look to the blog.  I guess I got tired of the previous look and finally got around to updating the theme as well as my version of WordPress.

Let me  know what you think!  Either post a comment, or click the new “like” button if you like the new look.. If you think it sucks, please post a comment why.

*Edit: Seems the site is throwing an error when someone posts a comment.. The comments are still being posted, you just get the additional feature of seeing a bunch of ugly PHP errors.