I have a site with thousand of pages crawled by facebookexternalhit bot.
Can I identify this bot, and serve just the <head> section with the og tags of my page?
Making this, I save some money with bandwidth and database access...
So my question is: What is the impact if I do it? Facebook needs to know what my site has inside the <body> tag?
Yes, provided there's a full set of meta tags served to Facebook's crawler there doesn't nee to be any other content: this is the similar to the 'pointers' functionality which is the recommended method for some edge-cases in Open Graph sharing:
https://developers.facebook.com/docs/opengraph/howtos/using-metadata-pointers
According to them:
Facebook allows its users to send links to interesting web content to
other Facebook users. Part of how this works on the Facebook system
involves the temporary display of certain images or details related to
the web content, such as the title of the web page or the embed tag of
a video. Our system retrieves this information only after a user
provides us with a link. You may have found this page because a
Facebook user sent a link from your website to other Facebook users.
If you have any questions or concerns about any links or content sent
by one of our users, please contact us at legal#facebook.com.
Basically if you do what you propose (and it'd be easy with a combination of RewriteCond and one extra QUERY_STRING param) you'll remove the possibility for Facebook to retrieve the meta info they need to build their nice post when an user insert a link in a chat, a private message, or a post.
I would rather try to understand if and when a certain page is hit multiple times in a short period since this shouldn't be the case.
Related
Our database has an entry for our companies' Facebook and Twitter pages. With Twitter, it's possible to create dynamic links based solely on the company's Twitter handler. For instance, if the company provides us with the Twitter handle acme, we can dynamically create a link to their Twitter page with <a href='http://www.twitter.com/#{company.twitter_name}'></a>.
In some instances, the same is true of Facebook. Coca Cola for instance has http://www.facebook.com/cocacola. Many other companies have a url that looks more like http://www.facebook.com/pages/acme/123456789. In the latter case, the numerical id at the end is necessary to reach the page. The URL http://www.facebook.com/pages/acme would not work.
My question is, is there a way to dynamically link to a Facebook company page with just their handle? Or do you always need to provide a full URL? I'm hoping Facebook has some magic back door for developers that I simply haven't happened upon yet. Thanks for your feedback, one way or the other!
A link in the form http(s)://facebook.com/profile.php?id={nummeric_id_here} always works, for pages as well as for user profiles.
It automatically redirects to the “real” address – to the username that the user or page might have set, or to an address in the form you mentioned (for pages that do not have enough likes yet to set their own user name).
I am building a social application, users post data to the website, which is saved in our database.
This creates a record on the site, which is searchable and creates the basic content and function of the site (the purpose is not relevant at this point)
When a record is saved to our database, I want to "spread the word" and send this data out to social networks. Currently, I'm looking at Facebook in isolation.
So, I know how to create a post through the Graph API and post this content to the users Timeline, or indeed to a business page associated with the APP/Website.. but I am not sure how, or if indeed one should, maintain continuity.
What I mean... if a user creates a record on my website, and then the website/App creates a post on my business page, and also asks the user to post it in their Timeline, how do I stop this being two separate posts, and instead one post which has been shared?
I want to achieve:
User posts on website
>
Website posts to Page
>
Post on Page is "Shared" to users Timeline
As opposed to:
User posts on website
>
Website posts to Page
>
Website posts an additional post to users Timeline
The reason I want to do this, is that on the website, I want to be able to show shares, likes and comments from Facebook by tracking the ID of the initial post created when first entered onto my website.
Or am I trying to reinvent the wheel and should just use Facebook's comment plugin?
When you create the post on facebook on the Page, store the returned post ID in your data model.
From what I can tell, there is no way to access the normal user share directly through the API. If you insist on doing it programmatically without popping up any dialog for your user, you can make a post to the user's page which has (the start of) the Page post and a linkback to the Page post as an attachment. This is probably to prevent abuse.
However, if you don't mind relying on an undocumented and deprecated endpoint, you can use the old sharer.php endpoint, so long as you have a fully qualified link to the post you want to share (you can retrieve the url through the api). This will also require your user to enter anything appropriate in their share and then click "share."
The endpoint is
http://www.facebook.com/sharer.php
Call it with the u parameter filled in with the url, so
http://www.facebook.com/sharer.php?u=[URL encoded URL of the post you wanted to call]
You can try this with any facebook post (go to a post, copy the url, past in as the parameter), it's still working (I just tried it) but there are no guarantees. See the top answer to Facebook API: "Share" a post already posted on a page's wall?.
You can still access likes, comments, etc for that post id through the Graph API (and you can provide your users a direct link to the post). Cache/update them as recommended and display them on your own page. You are basically mirroring back onto your own site what is happening on facebook in regards to the post you made.
I would go this route especially if you are at all planning on branching into other services. That way you can do an aggregated display of statistics/likes/etc from the multiple services you are having your platform repost to. This is also good for (at least an impression of) data integrity for your users: they know that your service represents everything they have done in case anything happens to their facebook/etc accounts.
This could especially be noteworthy if they are worried about facebook/etc deleting any of their posts, or for recovering from any issues where a post/comment/etc is not properly stored by facebook/etc (for example, comments have a maximum length which, at least via the main FB UI, silently drops anything above the maximum length in a non recoverable way for the user).
I'm developing an url shortener and the current specification requires to avoid Facebook from scraping those links and instead an integrated scraper will do that and hand over the og meta tags to Facebook.
Is there anything in Facebook terms that doesn't allow me to reply to its scraper with different content (e.g. an empty page with opengraph meta tags only) from what a regular user would see?
Thanks in advance.
I just did this on my site.
I am redirecing non-mobile devices to another page but want the facebook scraper to get the content a mobile device would get.
This is the User Agent I get:
facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
so matching against a regular pattern like this should detect the facebook scraper.
/^(facebookexternalhit.*)/
As mentioned above, this user agent can be spoofed easily which, in my case, doesn't matter.
Only problem could occur if facebook changes the user agent of their crawling script.
I have website that will both post to a user's Facebook wall, and allow him/her to share links through private Facebook messages.
The links that we would like to share can be behind a walled garden, meaning you'd have to be logged in to our site to see them. The problem is Facebook ends up sharing the redirect link instead of the original.
What is the correct way to handle this use case?
You need to generate "fake" pages with the og meta tags, and with a meta refresh, url tag, or some script with document.location. This pages should not need log in, and must contain only the shared information.
In my Google Analytics reports I get "facebook.com / referral" as the source. Is it possible to get the exact URL?
I don't think it's possible. as #yahelc pointed on a previous comment most traffic from facebook goes through a facebook controlled redirect on page facebook.com/l.php .So if you want to have campaigns on facebook you can use urls with campaign query parameters to keep track of it.
eg: link to
http://www.example.com/?utm_campaign=Facebook&utm_medium=social&utm_source=facebook.com
Now they will show up in GA as a separate campaign and you can tell how many visitors come from that specific link. You probably want to minify that link using bit.ly or goo.gl.
Create multiple campaigns on facebook and change the utm_campaign parameter as much as you want. You can also create different utm_content parameter to separate your marketing efforts on facebook. Keep the utm_medium and utm_source as static as on the example above.
This is how social marketing analytics measures marketing efforts on social networks. Anything that comes from facebook is not tagged you know comes from people posting links to your site other than you.
At the same time it really makes no sense to have the referral url at all. If you think about it most of the times it will be from private posts that you don't even have access to see, even if you had a url for it. That's just not the way facebook works. It doesn't have pages, it has streams and posts.
More about url tagging:
http://support.google.com/analytics/bin/answer.py?hl=en&answer=1033863
The answer is yes and no. You can drill down to referral path for facebook source in the report Traffic Sources -> Sources -> Refferals by simply pressing facebook.com at the Source coloumn, just like for all other visits from the referring site.
But that would be not much of a use, because for facebook you'll always see /l.php. And that's how facebook works, it doesn't allow visitors to visit the link immedeately, instead it redirects user to the page with url facebook.com/l.php?u=<link-to-your-site.com> with a redirect or maybe with some text like "if you're sure you want to leave", so technically, the referring page would be this /l.php that GA shows.
So if you need to track the efficency of your Facebook activities - use utm tags, like #Eduardo Cereto mentioned. Here's a very nice video tutorial on link tagging for GA: http://services.google.com/analytics/breeze/en/v5/campaigntracking_adwordsintegration-v23_ia5/ (starts from p. 17, you can skip all that goes before).
Hope it helps!
i just know this settings here:
http://www.sebastienpage.com/2009/05/06/google-analytics-trick-see-the-full-referring-url/