react-ga4
react-ga4 copied to clipboard
send_to attribute not being sent to Google API
The send_to attribute never seems to be added to the api call sent to google. I'm trying to use an ad tracker and the syntax I'm using is:
ReactGA.event({
action: "conversion",
category: "Conversion",
label: "RCQ-XXXXXXXXXXXXXXXX",
send_to: "AW-XXXXXXXXX/RCQ-XXXXXXXXXXXXXXXX",
});
The event is received but the send_to attribute isn't included. This is what is received when viewed in google tag assistant :
API Call
gtag("event", "Conversion", {
event_category: "Conversion",
event_label: "RCQ-XXXXXXXXXXXXXXXX",
value: undefined,
non_interaction: undefined
})
The ID in the send_to AW-XXXXXXXXX has been added to the init array and is recognized so that works.
I have tried different permutations of the send_to attribute including send_to and sendTo. Sending as an array didn't make a difference.
I'm baffled.
Thanks in advance for any help!
Try sending the event like this:
ReactGA.event("your_action", {
category: "Conversion",
label: "RCQ-XXXXXXXXXXXXXXXX",
send_to: "AW-XXXXXXXXX/RCQ-XXXXXXXXXXXXXXXX",
});
Using ReactGA.gtag instead of ReactGA.event works:
ReactGA.gtag('event', 'your_action', {
action: "conversion",
category: "Conversion",
label: "RCQ-XXXXXXXXXXXXXXXX",
send_to: "AW-XXXXXXXXX/RCQ-XXXXXXXXXXXXXXXX",
})