elgorditosalsero / react-gtm-hook

Easily manage the Google Tag Manager via Hook
https://elgorditosalsero-react-gtm-hook.netlify.app/
MIT License
220 stars 28 forks source link

Question about the `send_to` attribute #10

Closed zorzysty closed 4 years ago

zorzysty commented 4 years ago

It's not clear for me from the docs whether I should provide send_to attribute in the object passed to sendDataToGTM.

Original snippet I got from google:

gtag('event', 'conversion', {'send_to': 'my-gta-id/some-randomly-looking-string'});

So I guess my question is, should the code look like this:

sendDataToGTM({
  event: "conversion",
  send_to: "my-gta-id/some-randomly-looking-string",
  currency: order.currency,
  value: order.value,
});

or should I leave out send_to as it's not a custom attribute and the hook is already handling this:

sendDataToGTM({
  event: "conversion",
  currency: order.currency,
  value: order.value,
});

or maybe I should place send_to inside config object passed to the init function call?

elgorditosalsero commented 4 years ago

Hi!

I never have seen the send_to params, probably the marketing team with I've worked/I'm working never needed it, btw, I'm trying to find some doc about how to handle this within the GTM...

How do you configure it into the GTM?

As I know, if you're using the GTM you should not use the gtag.js

Can u provide some more info about this?

Btw, the library sends the whole object to the GTM, so, if you need it, I think you could add it as in your first example.

zorzysty commented 4 years ago

Below are the instructions I received from the marketing team. Hope this makes sense to you :) obraz

elgorditosalsero commented 4 years ago

Hi @zorzysty,

sorry for the delay but I've asked some marketing guys and some of them told me the send_to isn't necessary if using one of the GA event from the Tag Manager.

I think u should ask some of the marketing team to learn more about this param.

Hope it helps 😄

zorzysty commented 4 years ago

That's awesome :) Thanks for the reply. Appreciate it!

elgorditosalsero commented 4 years ago

I'm closing for now, if you have more info or updates let me know 😄