How To Add FB Pixel’s Code Into A Button that open Whatsapp And Ready to Send A Message

Sometimes we need to track how many clicks happened to our button as we send paid traffic to the landing page. Without knowing this we cannot optimize and cannot measure the effectiveness of our ads.
Below button when clicked will send “Lead” event to the Facebook analytic and also will open Whatsapp automatically (when opened in a mobile device with Whatsapp installed) with a predefined message to the designated number.

How To Add FB Pixel's Code Into A Button that open Whatsapp And Ready to Send A Message 1

This is the code:

<button class=”float-none submit-button” id=”myButton1″>Hubungi CS kami di WA 0812 xxxx xxxx</button><script type=”text/javascript”>
document.getElementById(“myButton1”).onclick = function ()
fbq(‘track’, ‘Lead’);‘,%20saya%20tertarik)’);

Before this can be tracked this event you need to install pixel code before </head> usually in the header file.
The code is something like this:

<!– Facebook Pixel Code –>
s.parentNode.insertBefore(t,s)}(window, document,’script’,
fbq(‘init’, ‘1xxxxxxxxxxxxxxx’);
fbq(‘track’, ‘PageView’);
<noscript><img height=”1″ width=”1″ style=”display:none”
<!– End Facebook Pixel Code –>

Good luck!

READ  Telegram Web, The Effective Way To Use Telegram From PC

Leave a Reply