0

Using a React Native boiler plate with Expo and Redux, we like to use the Amplitude tracking service which involves first initializing with

Amplitude.initialize(apiKey)

followed by logging events in various React Components, such as

Amplitude.logEvent(eventName)

Question: Where in the React Native app structure (especially in the linked boilerplate) will you place the Amplitude.initialize(apiKey) code?

It works when the code is placed in the componentDidMount function of the Setup component in /src/boot/setup.js, but is that the best place to place it?

Thank you!

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830

1 Answers1

2

I am not really into react-native but, this question is interesting for me.

I've read some articles and I believe this answer is a hit, since it included almost a summarized research about this topic.

Also, possible approach to take is having your keys encrypted via JWT at your Back-side, then, requested and decrypted via Front-end?

Sultan H.
  • 2,908
  • 2
  • 11
  • 23
  • Thats a great topic, and I am storing the sensitive secrets such as API keys in a `.env` file while which is then pulled by a npm/babel package. I believe regular React apps can do this easily, its just a lot trickier in react native apps. – Nyxynyx Jul 20 '19 at 16:08
  • I really hoped that would help, I know it's a lil bit complix to do it since you have almost no control about the environment where the app runs _Android_ – Sultan H. Jul 20 '19 at 16:38
  • Hope you find a way that fits! – Sultan H. Jul 20 '19 at 16:38