Surendra Sharma

Surendra Sharma

Search This Blog

Sunday, April 12, 2015

How to implement Facebook Tag API script or Facebook Analytic tracking script

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&amp;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.

8 comments:

  1. The project manager’s leadership abilities made a strong impression.
    San Francisco branding

    ReplyDelete
  2. Their team was excellent about managing the work and our expectations
    UX design companies

    ReplyDelete
  3. Loved my encounter working with, my personal chance upon and hangs up upward an effective route with regard to escalating looking jobs.best website design companies

    ReplyDelete
  4. Whatever you have provided for us in these posts really appreciative.
    UX design agency

    ReplyDelete
  5. The quality of your articles and contents is great.
    San Francisco creative agency

    ReplyDelete
  6. It feels awe-inspiring to read such informative and distinctive articles on your websites. UI design companies

    ReplyDelete
  7. It’s my fortune to go to at this blog and realize out my required stuff that is also in the quality. clever messenger vs manychat

    ReplyDelete