I'm using react-ga and is working great. I can call events and track the pages.
But the script of conversions in Google Adwords is a bit different:
<script>
function gtag_report_conversion(url) {
var callback = function () {
if (typeof(url) != 'undefined') {
window.location = url;
}
};
gtag('event', 'conversion', {
'send_to': 'AW-XXXX/XXXX',
'value': 140.0,
'currency': 'BRL',
'transaction_id': '',
'event_callback': callback
});
return false;
}
</script>
With React-GA I can register events like this:
ReactGA.event({
category: "User",
action: "Click Whatsapp button",
value: 1,
});
The problem is that object doesn't have the properties "send_to", "event_callback", "currency", "transaction_id".
So I have to use the ga object to do this (I think). I don't know if there is a difference between the ga object or the gtag object that Google Adwords tell me to use.
There is my try to register the conversion but nothing happens:
ReactGA.ga("event", "conversion", {
send_to: "AW-XXXX/XXXX",
value: 140.0,
currency: "BRL",
transaction_id: "",
});