Track Facebook Instant Articles with CleverTap


#1

Steps to track

  1. Make sure you have a Facebook page + Facebook App ID
  2. When publishing an article via FB Instant article, in the article body, inject our JS
< figure class = "op-tracker" > < iframe > < script type = "text/javascript" >
	var clevertap = {
		event: [],
		profile: [],
		account: [],
		onUserLogin: [],
		notifications: []
	};
clevertap.account.push({
	"id": "CLEVERTAP_ACCOUNT_ID"
});
(function() {
	var wzrk = document.createElement('script');
	wzrk.type = 'text/javascript';
	wzrk.async = true;
	wzrk.src = ('https:' == document.location.protocol ? 'https://d2r1yp2w7bby2u.cloudfront.net' : 'http://static.clevertap.com') + '/js/a.js';
	var s = document.getElementsByTagName('script')[0];
	s.parentNode.insertBefore(wzrk, s);
})(); < /script> </iframe > < /figure>

‚Äč3. In the same iframe you can also record an event for article viewed.

clevertap.event.push("Article Viewed", {
  "Page name":"Homepage",
  "Category":"home"
});

Tip: Facebook has an ia_document js object which has additional parameters (when someone reads an article) if a customer wants to track these as properties of the Article read event.

Reference: https://developers.facebook.com/docs/instant-articles/analytics#analytics-services