WebSite X5Help Center

 
Mandar V.
Mandar V.
User

Google Ads Conversation Tracking codes  en

Autore: Mandar V.
Visite 38, Followers 0, Condiviso 0  

Hello WX5 masters. Need your guidance.

Client has provided me 2 different codes for Google Ads Conversation Tracking. 

Step 1 is installing Google tag - 

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-11105800220"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'AW-11105800220');
</script>

Steo 2 is adding conversation script -

<!-- Event snippet for Contact conversion page
In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->
<script>
function gtag_report_conversion(url) {
var callback = function () {
if (typeof(url) != 'undefined') {
window.location = url;
}
};

gtag('event', 'conversion', {
'send_to': 'AW-11105800220/tOs8CKgmt_gbEUyg1k8p',
'value': 1.0,
'currency': 'INR',
'event_callback': callback
});
return false;
}
</script>

Step 3 is a creating HTML button link - 

Example button -

<button onclick="gtag_report_conversion();">
Submit
</button>

Example link - 

<a href="thankyou.html" onclick="return gtag_report_conversion('thankyou.html');">
Contact Us
</a>

I am confused. Please guide.

Regards

Postato il

Nessun commento