Facebook Instant Article(FBIA) 的 ia_document 对象(用于分析)及其属性的详细信息?
Facebook Instant Article(FBIA)’s ia_document object (for analytics) and its properties in detail?
我正在尝试跟踪 Facebook Instant Articles (FBIA) 中 Author
的 google 分析数据。请参阅下面给出的示例中的评论:
<item>
<title>
Article's Title
</title>
<description>Article's description</description>
<link>http://www.example.com/7216240</link>
<guid>7216240</guid>
<pubDate>Mon, 28 Aug 2017 10:31:50 +0200</pubDate>
<author>Author Name</author> // <-- This is the tag that I want to track in analytics
<content:encoded>
<![CDATA[
<!doctype html> <html lang="en" prefix="op: http://media.facebook.com/op#"> <head> ... </head> <body> <article>
...
</article> </body> </html>
]]>
</content:encoded>
</item>
根据 facebook 关于 Analytics for Instant Articles 的开发者文档:
Facebook also exposes a defined set of Instant Article data, which the
analytics trackers can use optionally. For JavaScript tracking codes,
that data is available in the ia_document JavaScript object.
<figure class="op-tracker">
<iframe>
<script>
// The URL the user shared
var urlSharedByUser = ia_document.shareURL;
// The article title
var title = ia_document.title;
// Referrer is always set to 'ia.facebook.com'
var referrer = ia_document.referrer;
</script>
</iframe>
</figure>
但是,它没有详细描述 ia_document
对象中有哪些属性。
关于 SO 的一些问答只用有限的例子解释,比如
<figure class="op-tracker">
<iframe>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('require', 'displayfeatures');
ga('set', 'campaignSource', 'Facebook');
ga('set', 'campaignMedium', 'Social Instant Article');
ga('set', 'title', ia_document.title);
ga('set', 'referrer', ia_document.referrer);
ga('send', 'pageview');
</script>
</iframe>
</figure>
是否有任何文章详细解释了 Facebook Instant Article(FBIA) 的 ia_document 对象(用于分析)及其属性?
除了ia_document.title
、ia_document.shareURL
和ia_document.referrer
,我们还有什么?就我而言,我们有 ia_document.author
吗?
刚发现有一个浏览器调试工具提供了 Instant Articles 环境的近似值。所以让我只回答我自己的问题。浏览器调试工具URL如下:
www.ia-tracker.fbsbx.com/instant_article_test?url=<share-url>
在浏览器控制台测试后,我可以得出结论,只有 3 个属性属于 ia_document,分别是 ia_document.title
、ia_document.shareURL
和 ia_document.referrer
.
见下方截图:
我正在尝试跟踪 Facebook Instant Articles (FBIA) 中 Author
的 google 分析数据。请参阅下面给出的示例中的评论:
<item>
<title>
Article's Title
</title>
<description>Article's description</description>
<link>http://www.example.com/7216240</link>
<guid>7216240</guid>
<pubDate>Mon, 28 Aug 2017 10:31:50 +0200</pubDate>
<author>Author Name</author> // <-- This is the tag that I want to track in analytics
<content:encoded>
<![CDATA[
<!doctype html> <html lang="en" prefix="op: http://media.facebook.com/op#"> <head> ... </head> <body> <article>
...
</article> </body> </html>
]]>
</content:encoded>
</item>
根据 facebook 关于 Analytics for Instant Articles 的开发者文档:
Facebook also exposes a defined set of Instant Article data, which the analytics trackers can use optionally. For JavaScript tracking codes, that data is available in the ia_document JavaScript object.
<figure class="op-tracker">
<iframe>
<script>
// The URL the user shared
var urlSharedByUser = ia_document.shareURL;
// The article title
var title = ia_document.title;
// Referrer is always set to 'ia.facebook.com'
var referrer = ia_document.referrer;
</script>
</iframe>
</figure>
但是,它没有详细描述 ia_document
对象中有哪些属性。
关于 SO 的一些问答只用有限的例子解释,比如
<figure class="op-tracker">
<iframe>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('require', 'displayfeatures');
ga('set', 'campaignSource', 'Facebook');
ga('set', 'campaignMedium', 'Social Instant Article');
ga('set', 'title', ia_document.title);
ga('set', 'referrer', ia_document.referrer);
ga('send', 'pageview');
</script>
</iframe>
</figure>
是否有任何文章详细解释了 Facebook Instant Article(FBIA) 的 ia_document 对象(用于分析)及其属性?
除了ia_document.title
、ia_document.shareURL
和ia_document.referrer
,我们还有什么?就我而言,我们有 ia_document.author
吗?
刚发现有一个浏览器调试工具提供了 Instant Articles 环境的近似值。所以让我只回答我自己的问题。浏览器调试工具URL如下:
www.ia-tracker.fbsbx.com/instant_article_test?url=<share-url>
在浏览器控制台测试后,我可以得出结论,只有 3 个属性属于 ia_document,分别是 ia_document.title
、ia_document.shareURL
和 ia_document.referrer
.
见下方截图: