简体   繁体   中英

How do I make content available on my site in exchange for a Facebook “like”

I have a site with a lot of for-purchase content. I also have some sampler content for "free".

A LOT of people download this sample content, and I would like to now only allow access to the free content if the user is willing to "like us" on facebook.

How can I implement this? I'm a rails developer, but it may not matter what the app is.

How can I ask a user to like us, and then verify that they have?

This answer is probably where you want to start: How can I make sure that someone has successfully "liked" my site when they press the "like" button on my site?

FB.Event.subscribe('edge.create', function(response) {
  // fire an ajax call to store that the user has liked you
});

So then you'd handle in javascript that they have liked you, and you can unlock content to your new friends.

The best option is using the Javascript SDK from facebook. You can read all likes from an user or ask for specific page:

FB.api("/me/likes/" + PAGE_ID, function(response) {
    // Do some staff here with page data
 })

FB.api("/me/likes/", function(response) {
    // Do some staff here with all pages data
 })

You can use the Graph API explorer in order to test this:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM