rudderlabs / rudder-sdk-js

JavaScript SDK for RudderStack - the Customer Data Platform for Developers.
https://www.rudderstack.com
Other
144 stars 84 forks source link

Google Analytics native sdk requires explicit `integrations: {All: true}` #51

Closed pierreavizou closed 4 years ago

pierreavizou commented 4 years ago

If you're using the integrations parameter on a rudder's sdk method, to selectively disable some destinations (and supposedly leave all others enabled), it also disables calls to Analytics native SDK.

Thus, the code below

rudderanalytics.track(action, {
      category,
      label,
    }, {
      integrations: {
        'Customer IO': false,
        Hotjar: false,
      },
    });

would not perform a call to Google's tracking endpoint. To force the call being made, you have to add an explicit All: true property to integrations.

I'm not sure this is a bug per se, but it took me a while to figure out, since the docs tend to indicate that by only passing false for some destinations "event data is sent to all the other destinations except those". Therefore we would expect data to be sent to Analytics without requiring All: true

It might also be worth noting that when using Analytics in cloud mode, everything works as expected.

sayan-rudder commented 4 years ago

Thanks for bringing this to our notice. Sorry for the delay..got caught up with something We will check this soon and get back to you.

sayan-rudder commented 4 years ago

we have updated our doc https://docs.rudderstack.com/sdk-integration-guide/getting-started-with-javascript-sdk#how-to-filter-selective-destinations-to-send-event-data

please let us know if you find this useful

pierreavizou commented 4 years ago

Thanks for following up on this.

The docs this still state that "Unless explicitly defined otherwise, 'All' is always set to true. This means that sending events to all destinations is enabled by default.", which seems actually pretty natural, and is IMO the behavior expected by users.

However, the observed is different, as shown in the first post. So there might actually be a mall quirk in the JS SDK that causes All: true not to be the case by default for GA in native sdk mode, unless passed explicitly, which should not be needed.

Let me know if I missed something or if I can give you additional details

sayan-rudder commented 4 years ago

yes, we also added that change in the sdk itself to sync the behaviour. We updated the web SDK distribution with the same

pierreavizou commented 4 years ago

Oh ok sorry I missed that! Then I guess the issue can be considered resolved :)

sayan-rudder commented 4 years ago

thanks :)