Reputation: 491
I previously asked about making a custom like message on a users page and was directed to use open graph. I have tried the tutorial and can't seem to get it to work with my like button, can anyone help or offer some advice?
i have used the debug tool and get no errors and am a little confused as to what i should do next. My app uses a fixed php header and the body content is changed dynamically using AJAX. what i am trying to do is get a user to 'like' a coupon and it shows up on their site with my custom message, something like "someone has used coupon A from www.somesite.com"
Below is what is in my head;
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# <?php echo APP_NAME;?> fb: http://ogp.me/ns/fb/<?php echo APP_NAME;?># test: http://ogp.me/ns/fb/test#">
<meta property="fb:app_id" content="xxxxxxxxxxxxxxx" />
<meta property="og:type" content="<?php echo APP_NAME;?>:coupon" />
<meta property="og:url" content="http://somesite.com/" />
<meta property="og:title" content="Sample Coupon" />
<meta property="og:description" content="Some Arbitrary String" />
<meta property="og:image" content="http://ogp.me/logo.png" />
and here is my like script, which currently works, but for the page and not the coupon.
<!-- Code for FB like button -->
<div id="fb-root"></div>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=xxxxxxxxxxxxxxx";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-like" data-href="http://apps.facebook.com/test/" data-send="false" data-width="450" data-show-faces="false"></div>
Upvotes: 0
Views: 2084
Reputation: 281
Using the open graph tags only enable you to post stories like this: User XYZ likes ABC on website.com
If you would like to specify your own actions (e.g. use) and objects ('coupon') you also need to create an application that will allow you to do this.
You can find a step by step tutorial on how to do this here: https://developers.facebook.com/docs/opengraph/tutorial/
Upvotes: 1