Facebook
analytic is great way to track your website access by analyzing
custom audience source. Facebook called it as Facebook Tag API.
To work with this you need Facebook tracking ID. I represented it as “NNNNN”. In project store it either in web.config or database. Below is script
that you need to place it before the end of </body>
section of webpage.
<script>(function () {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
_fbq.push(['addPixelId', 'NNNNN']);
})();
window._fbq
= window._fbq || [];
window._fbq.push(['track', 'PixelInitialized', {}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=NNNNN&ev=PixelInitialized" /></noscript>
This much of information is enough to implement it in
any web application like ASP.NET etc. Though programmer don’t like much theoretical
reading however you can read more from https://developers.facebook.com/docs/ads-for-websites/tag-api
Please leave your comments or share this script if it’s useful for you.