All Projects β†’ innFactory β†’ react-native-aws-mobile-analytics

innFactory / react-native-aws-mobile-analytics

Licence: MIT license
A react-native module for using Amazon's AWS Mobile Analytics with the aws-sdk

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-aws-mobile-analytics

gulp-styl
Preprocess CSS with Styl
Stars: ✭ 21 (+31.25%)
Mutual labels:  deprecated
aws-webrtc-recognition-example
Example with WebRTC , AWS Rekognition πŸ‘
Stars: ✭ 18 (+12.5%)
Mutual labels:  amazon
rocketnative-sublime-snippets
[DEPRECATED] Rocketseat React Native snippets for Sublime Text Editor
Stars: ✭ 16 (+0%)
Mutual labels:  deprecated
HuntTheYetiAlexa
Play the game Hunt the Yeti on the Amazon Echo
Stars: ✭ 17 (+6.25%)
Mutual labels:  amazon
node-amazon
E-commerce website done in Node, and Angular 11 (SSR)
Stars: ✭ 48 (+200%)
Mutual labels:  amazon
Competitive-Programming-Solutions
COMPETITIVE PROGRAMMING PRACTICE QUESTIONS
Stars: ✭ 28 (+75%)
Mutual labels:  amazon
alexa-verifier-middleware
An express middleware that verifies HTTP requests sent to an Alexa skill are sent from Amazon.
Stars: ✭ 31 (+93.75%)
Mutual labels:  amazon
laravel-localization-route-cache
Translated Route Caching Solution for Laravel Localization
Stars: ✭ 49 (+206.25%)
Mutual labels:  deprecated
terraform-emr-spark-example
An example Terraform project that will configure a Secure and Customizable Spark Cluster on Amazon EMR.
Stars: ✭ 43 (+168.75%)
Mutual labels:  amazon
amazon-reviews
Sentiment Analysis & Topic Modeling with Amazon Reviews
Stars: ✭ 26 (+62.5%)
Mutual labels:  amazon
aws-sqs-sns-client
AWS SNS SQS client UI
Stars: ✭ 26 (+62.5%)
Mutual labels:  amazon
cmsplugin-filer
DEPRECATED, this project is no longer maintained, see README for more information.
Stars: ✭ 127 (+693.75%)
Mutual labels:  deprecated
HTTPClient.jl
DEPRECATED, USE HTTP.jl INSTEAD
Stars: ✭ 17 (+6.25%)
Mutual labels:  deprecated
DeepDIVA
⛔️ DEPRECATED <Python Framework for Reproducible Deep Learning Experiments>
Stars: ✭ 32 (+100%)
Mutual labels:  deprecated
open-pos
Open Source Point of Sale System.
Stars: ✭ 52 (+225%)
Mutual labels:  deprecated
Optimizely-iOS-SDK
Optimizely Classic iOS SDK. For Optimizely X Mobile go here:
Stars: ✭ 31 (+93.75%)
Mutual labels:  deprecated
tooltip
[DEPRECATED] The tooltip that has all the right moves
Stars: ✭ 133 (+731.25%)
Mutual labels:  deprecated
gulp-recess
[DEPRECATED] Lint CSS and LESS with RECESS
Stars: ✭ 42 (+162.5%)
Mutual labels:  deprecated
golang-tts
Text-to-Speach golang package based in Amazon Polly service
Stars: ✭ 19 (+18.75%)
Mutual labels:  amazon
varnish-geoip-plugin
GeoIP plugin for Varnish
Stars: ✭ 18 (+12.5%)
Mutual labels:  deprecated

react-native-aws-mobile-analytics

Build Status Version Downloads

A react-native module for using Amazon's AWS Mobile Analytics with the aws-sdk

Highly inspirated by the javascript version aws-sdk-mobile-analytics-js


Usage

Add react-native-aws-mobile-analytics

npm install --save react-native-aws-mobile-analytics

Add Permission for Network State to your AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Add aws-sdk

npm install --save aws-sdk

react-native-aws-mobile-analytics needs the react-native-device-info package as dependency for an unique client id. Make sure it is correct linked. You may have to call react-native link:

react-native link

Create file MobileAnalytics.js where you can do the configuration:

import AWS from "aws-sdk/dist/aws-sdk-react-native";
import AMA from "react-native-aws-mobile-analytics";
import {
    Platform,
} from 'react-native';

AWS.config.region = 'us-east-1';
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
    region: 'us-east-1',
    IdentityPoolId: 'us-east-1:4c6d17ff-9eb1-4805-914d-8db8536ab130',
});


let appId_PROD = "2e9axxxxxxx742c5a35axxxxxxxxx2f";
let appId_DEV = "xxxx44be23c4xxx9xxxxxxxxxxxxx3fb";

let options = {
    appId: __DEV__?appId_DEV:appId_PROD,
    platform : Platform.OS === 'ios' ? 'iPhoneOS' : 'Android',
    //logger: console // comment in for debugging
};

const MobileAnalyticsClient  = new AMA.Manager(options);
export default MobileAnalyticsClient;

Before you could send the first event you have to call MobileAnalyticsClient.initialize(callback) and wait for the callback. You can handle that in your root component like following:

import React from "react";
import MobileAnalyticsClient from "./MobileAnalytics";
import SomeComponent from "./components/SomeComponent";

export default class App extends React.Component {
    constructor(){
        super();

        this.state = {
            isMobileAnalyticsLoading: true,
        };

        MobileAnalyticsClient.initialize(()=>this.setState({isMobileAnalyticsLoading: false}));
    }
    render() {
        if(this.state.isMobileAnalyticsLoading){
            return null;
        }
        return (
          <SomeComponent/>
        );
    }
};

Now you are able to send event in all your components:

import MobileAnalyticsClient from "../MobileAnalytics";


export default class SomeComponent extends Component {
    constructor() {
        super();
        // send a custom event
        MobileAnalyticsClient.recordEvent('analyticsDemo', { 'attribute_1': 'main', 'attribute_2': 'page' }, { 'metric_1': 1 });
    }
}

Checkout the full example:

react-native-aws-mobile-analytics-demo


Contributors

Anton SpΓΆck

Powered by innFactory

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].