-
Notifications
You must be signed in to change notification settings - Fork 253
Manual installation
-
npm install --save react-native-google-analytics-bridge
-
In XCode, right-click the Libraries folder under your project ➜
Add Files to <your project>
. -
Go to
node_modules
➜react-native-google-analytics-bridge
➜ios
➜RCTGoogleAnalyticsBridge
and add theRCTGoogleAnalyticsBridge.xcodeproj
file. -
Go to your apps project settings ➜ "Build Phases" ➜ "Link Binary With Libraries" and add
libRCTGoogleAnalyticsBridge.a
from the linked project. -
Next you will have to link a few more SDK framework/libraries which are required by GA (if you do not already have them linked.) Go to your project settings (root folder on the left pane) ➜ "Build Phases" ➜ "Link Binary With Libraries" then click the
+
and add the following:- CoreData.framework
- SystemConfiguration.framework
- libz.tbd
- libsqlite3.0.tbd
-
Optional step: If you plan on using the advertising identifier (IDFA), then you need to do two things:
- Add AdSupport.framework under "Link Binary With Libraries". (As with the other frameworks in step 5).
- Go to Xcode ➜
Libraries
➜RCTGoogleAnalyticsBridge.xcodeproj
➜ right-clickgoogle-analytics-lib
. Here you need toAdd files to ..
, and addlibAdIdAccess.a
from thegoogle-analytics-lib
directory. This directory is located in the samenode_modules
path as in step 3. - (Optional): In order to avoid having to re-add
libAdIDAccess.a
each time you install dependencies, consider patching thereact-native-google-analytics-bridge
dependency to add this automatically for you: https://blog.novanet.no/easier-react-native-upgrade-with-patch-package/
Make sure you have the following SDK packages installed in the Android SDK Manager:
- Google Repository
- Google Play services
- Google APIs (Atom) system image
Consult this guide if you are unsure how to do this.
npm install --save react-native-google-analytics-bridge
- Add the following in
android/settings.gradle
...
include ':react-native-google-analytics-bridge', ':app'
project(':react-native-google-analytics-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-analytics-bridge/android')
- And the following in
android/app/build.gradle
...
dependencies {
...
compile project(':react-native-google-analytics-bridge')
}
- Register package in
MainApplication.java
// Step 1; import package:
import com.idehub.GoogleAnalyticsBridge.GoogleAnalyticsBridgePackage;
public class MainApplication extends Application implements ReactApplication {
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
// Step 2; register package:
new GoogleAnalyticsBridgePackage()
);
}
}
Can we track Enhanced E commerce data from app using this flow?