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 = '//';
        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', {}]);
    <noscript><img height="1" width="1" alt="" style="display:none" src=";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

Please leave your comments or share this script if it’s useful for you.


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

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

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

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

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

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

  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