react-ga4 icon indicating copy to clipboard operation
react-ga4 copied to clipboard

send_to attribute not being sent to Google API

Open kenadian opened this issue 2 years ago • 2 comments

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!

kenadian avatar Mar 22 '23 20:03 kenadian

Try sending the event like this:

ReactGA.event("your_action", {
  category: "Conversion",
  label: "RCQ-XXXXXXXXXXXXXXXX",
  send_to: "AW-XXXXXXXXX/RCQ-XXXXXXXXXXXXXXXX",
});

vkalchuk avatar Mar 30 '23 18:03 vkalchuk

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",
})

Gwiad avatar Apr 11 '23 20:04 Gwiad