Skip to content

[Content]: Clarify steps for Google Firebase Integration for React Native users with env vars #3085

@lyqht

Description

@lyqht

What article on segment.com/docs is affected?

https://segment.com/docs/connections/destinations/catalog/firebase

What part(s) of the article would you like to see updated?

Getting Started on Android

Need clarification on Step 6 which gives this command.

Analytics analytics = new Analytics.Builder(context, writeKey)
  .use(FirebaseIntegration.FACTORY)
  ...
  .build();

In a React Native project, i store all my environment variables in a .env file. I'm not sure on the Android side how do I pass that env variable over to the java files, would like the instructions to be clearer on that.

Getting Started on iOS

Need more clarification on Step 4

[config use:[SEGFirebaseIntegrationFactory instance]];

I can infer Step 3 and 4 is probably for AppDelegate.m file, but I'm not exactly sure where I should put this config variable since there is no other existing configs being declared in this file. Is it here after the [AnalyticsReactNative trackDeepLink:url withOptions:options]; ?

- (BOOL)application:(UIApplication *)application
            openURL: (NSURL *)url
            options:(nonnull NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {

  [AnalyticsReactNative trackDeepLink:url withOptions:options];
  [config use:[SEGFirebaseIntegrationFactory instance]];
  return YES;
}

But doing so gives me the error of

❌  /Users/lyqht/Billy/ios/Billy/AppDelegate.m:37:4: use of undeclared identifier 'config'

  [config use:[SEGFirebaseIntegrationFactory instance]];

I see that from another documentation page that there is this code to add

SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"YOUR_WRITE_KEY"];

// Add any of your Device-mode destinations.
[config use:[SEGGoogleAnalyticsIntegrationFactory instance]];

But again, I have no idea how to pass the environment variable in.

Any help is appreciated!

Additional information

Able to set up RN project with Segment and see tracked events. Just can't really figure out how to add the firebase plugin integration properly.

Metadata

Metadata

Assignees

Labels

contentWhen the bug is about content that needs to get fixedtriaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions