GithubHelp home page GithubHelp logo

alexxnica / cordova-plugin-ms-appinsights Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/cordova-plugin-ms-appinsights

0.0 0.0 0.0 447 KB

Cordova plugin for App Insights

License: Other

JavaScript 100.00%

cordova-plugin-ms-appinsights's Introduction

Application Insights plugin for Apache Cordova apps

This plugin allows you to add an Application Insights to your Apache Cordova app. Application Insights is a techonogy that sends telemetry from your app to the Azure portal.

More info about Application Insights technology could be found here

To use this plugin you'll need an account in Microsoft Azure. You might already have access to a group account through your organization, or you might want to get a Pay-as-you-go account. (While Application Insights is in Preview, it's free.)

For more API documentation see sample application and JSDoc for exposed functionality stored in www subfolder.

Supported platforms

  • Android
  • iOS
  • Windows

Sample usage

Application Insights API is available through window.appInsights object. To start using it you don't have to initialize it, just start calling its' methods

// This will send a custom-defined event to your appInsights account
var eventData = { ButtonId: "trackSingleEvent", Timestamp: new Date() };
appInsights.trackEvent('click', eventData);

// This will send data about how long some action is performed
appInsights.startTrackEvent("longRunningTask");
// Emulate some long-running action through `setTimeout`
setTimeout(function () {
     // When task is finished, call 'stopTrackEvent' with the same event as in 'startTrackEvent'
    appInsights.stopTrackEvent("longRunningTask");
}, 10000);

// This will send an exception information to your appInsights account
try {
    // Do some logic here which may
    throw new Error("Sample Error");
} catch (err) {
    // Catch an error and send it to appInsights
    appInsights.trackException(err);
}

More information about AppInsights API could be found here

Installation Instructions

Prerequisites

To build and run sample application

  • Clone this repository into a directory of your choice

    git clone https://github.com/MSOpenTech/cordova-plugin-appinsights.git

  • Create a cordova project and add the platforms you want to support

    cordova create AppInsightsSample --copy-from="cordova-plugin-appinsights/sample"

    cd AppInsightsSample

    cordova platform add android

    cordova platform add windows

    cordova platform add ios

  • Add the plugin to your project

    cordova plugin add ../cordova-plugin-appinsights --variable INSTRUMENTATION_KEY=<your_key>

  • Set up intrumentation key for AppInsights API. Modify the following line in config.xml file at the project root

    <preference name="instrumentation_key" value="$INSTRUMENTATION_KEY">

replace $INSTRUMENTATION_KEY with your key.

  • optional: install battery and network status plugins to track their events to AppInsights as well.

    cordova plugin add cordova-plugin-battery-status cordova-plugin-network-information

  • Build and run application: cordova run.

Copyrights

Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

cordova-plugin-ms-appinsights's People

Contributors

panarasi avatar ryanlowdermilk avatar sgrebnov avatar southwood avatar sureshja avatar vladimir-kotikov avatar

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.