neciu / react-mixpanel

Unofficial React bindings for Mixpanel
73 stars 19 forks source link

Question about GDPR compliance #27

Open fjtorres opened 5 years ago

fjtorres commented 5 years ago

Hello,

We are using your package to integrate our React Application with Mixpanel, however we are working to GDPR compliance and we are not sure if we can achieve it with your package. According to GPDR the cookie from Mixpanel should not be loaded until we obtain the consent of our users but.

How to achieve it using MixpanelProvider component? Some advice?

We are loading MixpanelProvider like next code.

ReactDOM.render((
    <BrowserRouter>
        <Provider store={store}>
          <MixpanelProvider mixpanel={mixpanel}>
            <Route component={App} />
          </MixpanelProvider>
        </Provider>
    </BrowserRouter>
  ), document.getElementById('root'));
neciu commented 5 years ago

I'd say there need to be some kind of switch which initialises mixpanel code. Maybe you'd like to propose a solution?

ak--47 commented 5 years ago

Mixpanel library has this by default: https://developer.mixpanel.com/docs/javascript#section-opting-users-out-of-tracking

// Opt a user out of data collection
mixpanel.opt_out_tracking();

// Check a user's opt-out status 
// Returns true if user is opted out of tracking locally
mixpanel.has_opted_out_tracking();

dunno if this library has those bindings though...