自动时间线动作发布

发布于 2024-12-10 14:42:59 字数 171 浏览 0 评论 0原文

按照 Facebook 的新开放图指南,我成功地在我们基于 WordPress 的网站上实现了时间轴和“阅读文章”操作。但指南要求您单击按钮来发布操作。这可能是一个愚蠢的问题,但是我们如何让它在用户输入文章后自动发布?这是在 Facebook 批准该行动之后发生的事情吗?

推荐栏有这个功能吗?这就是它的目的吗?

Following Facebook's Guide for the new open graph, I have managed to implement Timeline and "Read Article" Action on our WordPress-based site. But the guide makes you click a button to post the action. It might be silly question, but how do we make it automatically posting once user enters the article? Is that something that's happening AFTER the action has been approved by Facebook?

Does recommendation bar do that? Is that its purpose?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

萌面超妹 2024-12-17 14:42:59

是的,推荐栏就是这样做的。您可以在自己的代码中实现类似的功能,但推荐栏支持许多开箱即用的功能,例如仅在用户向下滚动 X% 时和/或在指定的时间间隔后发送活动。

使用此标记,应在栏加载后 5 秒内跟踪操作:

<div class="fb-recommendations-bar" data-href="{YOUR URL}" data-read-time="5"></div>

Yes, the Recommendations Bar does this. You could implement something similar in your own code but the Recommendations Bar supports a bunch of things out of the box like sending the activity only once the user scrolls X% of the way down and/or after a specified time interval.

Using this markup the action should be tracked in 5 seconds after the bar has loaded:

<div class="fb-recommendations-bar" data-href="{YOUR URL}" data-read-time="5"></div>
眼睛会笑 2024-12-17 14:42:59

推荐栏仍处于测试阶段,除了应用程序管理员/开发人员/测试人员之外,不适用于任何人。

只有 Facebook 批准操作后,最终用户才会收到发布的操作。如果您提供足够的说明,这通常需要一两天的时间。您需要确保用户能够从您的网站中删除他们的活动 - 这是提交操作的要求:

请确保您的用户可以

  1. 在文章出现的每个页面上全局打开/关闭共享。
  2. 在文章出现的每个页面上删除他们在您的应用内分享的文章。
  3. 仅当您确定有人有兴趣阅读该文章时才生成阅读操作。

对于我的 WordPress 网站,我使用了一些代码,例如:

setTimeout( function() {
    FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {
            //  publish action to facebook
            FB.api( '/me/{$action}', 'post', { article : '{$permalink}' } );
        } else if (response.status === 'not_authorized') {
            // the user is logged in to Facebook, 
            // but has not authenticated your app
        } else {
            // the user isn't logged in to Facebook.
        }
    });
}, 2000 );

The Recommendation Bar is still in beta and won't work for anyone other than the App Administrators / Developers / Testers.

End-users will only get actions published once Facebook has approved the action. This usually takes a day or two if you provide adequate instructions. You will need to make sure users are able to remove their activity from within your site - this is a requirement for submitting a action:

Please make sure your users can

  1. Turn sharing on/off globally on each page an article appears.
  2. Remove articles they shared within your app on each page an article appears.
  3. Only generate read actions when you're sure someone is interested in reading the article.

For my WordPress site, I used some code like:

setTimeout( function() {
    FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {
            //  publish action to facebook
            FB.api( '/me/{$action}', 'post', { article : '{$permalink}' } );
        } else if (response.status === 'not_authorized') {
            // the user is logged in to Facebook, 
            // but has not authenticated your app
        } else {
            // the user isn't logged in to Facebook.
        }
    });
}, 2000 );
养猫人 2024-12-17 14:42:59

使用一些 JavaScript 在页面加载后发布操作:

window.onload=postCook; 

Use some JavaScript to post the action after the page loads:

window.onload=postCook; 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文