当社のサービスにより、あらゆる企業がビジネスのプロモーションを行うことができます。
ユーザーはプロモーションを設定し、コードのスニペットをコピーして、プロモーションを iframe に表示する Web サイトに配置します。
プロモーションページにはFacebookのいいねボタンが埋め込まれており、クリックするとその企業のFacebookページに自動的に「いいね」がつきます。
これらのクリックを追跡し、ユーザーのダッシュボードに表示して、プロモーションがもたらした新しい「いいね」の数をユーザーが確認できるようにしたいと考えています。
FB.Event.subscribe を使用してみましたが、いいねボタンをクリックしてもイベントがトリガーされません。私たちは FB SDK を使用するのが本当に初めてなので、おそらく何かが欠けているでしょう...ここに私たちが持っているものがあります:
window.fbAsyncInit = function() {
FB.init({
appId : '424426844274364', // App ID
channelUrl : '//www.viralsweep.com/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('edge.create',
function(response) {
alert('You FB liked the URL: ' + response);
}
);
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));