Git Product home page Git Product logo

config-plugin-react-native-mparticle's Introduction

mParticle Expo Config Plugin

Sets up mParticle native setup code so you can use react-native-mparticle in your Expo project. It's designed for you to adapt and add your specific functionality to.

Install

Install the package from mParticle and this config plugin:

yarn add react-native-mparticle @dylmye/config-plugin-react-native-mparticle

For iOS only: Run npx pod-install after installing this plugin.

Set up the plugin in your app.json:

{
  "expo": {
    "plugins": [
      [
        "@dylmye/config-plugin-react-native-mparticle",
        {
          "androidMparticleKey": "us1-YOUR_ANDROID_KEY_HERE",
          "androidMparticleSecret": "YOUR_ANDROID_SECRET_HERE",
          "iosMparticleKey": "us1-YOUR_IOS_KEY_HERE",
          "iosMparticleSecret": "YOUR_IOS_SECRET_HERE",
        }
      ]
    ]
  }
}

Here's all the possible values. They're all optional however you need both the key and secret for each platform to activate mParticle for that platform.

See how to get your Android and/or iOS keys in this help guide.

If you want to enforce a Data Plan, see how to grab its ID and version in this guide.

Key Value
androidMparticleKey Key for Android input
androidMparticleSecret Secret for Android input
androidMparticleDataplanId Data Plan 'Plan ID'
androidMparticleDataplanVersion Data Plan 'v' number
iosMparticleKey Key for iOS input
iosMparticleSecret Secret for iOS input
iosMparticleDataplanId Data Plan 'Plan ID'
iosMparticleDataplanVersion Data Plan 'v' number

For bare React Native projects, you must ensure that you have installed and configured the expo package before continuing.

Adding other native code - Kits, User Attributes, etc

The mParticle setup code is quite custom in nature. Identifying users/IDSync, event tracking and user attributes are bespoke to your system and not every use case can be captured in this plugin. This plugin is intended to act as a base, with the intention that you clone it and integrate it with your expo project. You can see in the app.json of the example project how it imports this plugin as a relative import instead of an npm module.

To modify this package:

  1. Clone it locally and put it in a folder within your Expo project, like plugins/mparticle. You can delete the .git & example folders
  2. Make your changes - the setup code is in ios/AppLifecycleDelegate.swift and android/src/main/java/expo/modules/mparticle/MparticlePluginApplicationLifecycleListener.kit (quite the mouthful!)
  3. If you need to add any additional variables, you can add them into the withApiKeys method in plugin/src/index.ts
  4. Run yarn plugin build
  5. Add your configuration to your Expo app app.json file as done in the example app

You don't need to rebuild the plugin every time you make changes to the Swift/Kotlin code, however you should do another prebuild.

The author of this plugin cannot provide any support for specific feature support. This library is also not officially supported by mParticle.

Contributing

Contributions are very welcome! Please refer to guidelines described in the contributing guide.

Make sure to test your changes with the example app.

To create a release, bump the version number in package.json (in its own commit) then create a tag using git tag vx.x.x (where x.x.x is the semantic release version), then push it with git push && git push --tags.

Testing process

  1. Make changes to plugin
  2. Run yarn plugin build to build changes
  3. In example dir, run yarn expo prebuild --clean

Authors

Disclaimer

This plugin is not created by, nor associated with mParticle Inc, its subsidiaries or affiliates. mParticle is a registered trademark of mParticle, Inc.

config-plugin-react-native-mparticle's People

Contributors

dylmye avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

config-plugin-react-native-mparticle's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.