I have setup a Google Ads account and a conversion goal. In my website I have added a button Facebook customer chat. I would like to add Google Ads conversion tracking code to the fb chat button so that every time someone starts chatting the system tracks the conversion. (preferably without using Google Tag Manager)
Here is the chat code so far without the tracking code:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
xfbml : true,
version : 'v3.3'
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- Your customer chat code -->
<div class="fb-customerchat"
attribution=setup_tool
page_id="xxxxxxxxxxx"
theme_color="#9B813B"
logged_in_greeting="We are live and ready to chat with you now. Say something to start a live chat."
logged_out_greeting="We are live and ready to chat with you now. Say something to start a live chat."
greeting_dialog_display="show"
greeting_dialog_delay="5">
</div>
And here is the tracking code I got from Google AdWords Conversion on AJAX Form? :
window.google_trackConversion({
google_conversion_id: 'AW-xxxxxxxxx',
google_conversion_language: "en",
google_conversion_format: "3",
google_conversion_color: "ffffff",
google_conversion_label: "xxxxxxxxx",
google_remarketing_only: false,
onload_callback : function() {
console.log("Conversion Sent Contact");
}
});
Thank you!
You could add a onclick function to the chat button to fire the google ads conversion script