Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where do we need to put the code #24

Closed
bondanherumurti opened this issue Aug 29, 2016 · 3 comments
Closed

Where do we need to put the code #24

bondanherumurti opened this issue Aug 29, 2016 · 3 comments

Comments

@bondanherumurti
Copy link

So where do we need to put the code

var Analytics = require('react-native-firebase-analytics');

componentWillMount() {
  if (environment === 'staging') {
    Analytics.setEnabled(false);
  }


  Analytics.setUserId('11111');
  Analytics.setUserProperty('propertyName', 'propertyValue');

  Analytics.logEvent('view_item', {
    'item_id': 'login'
  });

}

on every screen.js / index.ios.js ? and what is UserID? is that custom property or property defined from Google?

@alexHlebnikov
Copy link

You need to add it onlue in your App.js (or something) - in your root component.

@alexHlebnikov
Copy link

UersID is the same thing as Device ID, you can get it with this package https://github.com/rebeccahughes/react-native-device-info

@evollu
Copy link
Owner

evollu commented Sep 22, 2016

looks like solved

@evollu evollu closed this as completed Sep 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants