<commit_before># Full Documentation for Cordova SDK

This documentation outlines the functionality of the Branch Metrics Cordova SDK, and how to easily incorporate it into a Cordova app. The Cordova SDK shares the same code base as the Branch Web SDK, and includes functions to call all of the same API endpoints.

Live demo of the Web SDK: [https://cdn.branch.io/example.html](https://cdn.branch.io/example.html)

To use the Cordova SDK, you'll need to first initialize it with your Branch Key found in your [Branch dashboard](https://dashboard.branch.io/#/settings). You'll also need to register when your users login with `setIdentity`, and when they logout with `logout`.

### Register you app

You can sign up for your own Branch Key at [https://dashboard.branch.io](https://dashboard.branch.io)

### Quick Install of Cordova/Phonegap SDK

This Web SDK can also be used for Cordova/Phonegap applications.  It is provided as a plugin and can be installed with Cordova plugin or the Plugman tool.  Point the tool at this repositry, https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK.  For example:

```sh
cordova plugin add https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK
```

Note that this SDK is meant for use with full Cordova/PhoneGap apps.  If you are building a hybrid app using an embedded web view and you want to access the Branch API from native code you will want to use the platform specific SDKs and pass data into Javascript if needed.

### Running Cordova Testbed App
This repo includes a sample app, that demonstrates all of the available methods in the Branch Cordova SDK.
Building this app is very simple:

Switch to the Cordova dir
```
$ cd cordova-testbed
```

Run the init script to install all the required plugins
```
$ ./init.sh
```

Build the Cordova app and launch in the iOS emulator
```
$ cordova emulate ios
```

#### Initialization and Event Handling

You should initialize the Branch SDK session once the ‘deviceready’ event fires and each time the ‘resume’ event fires.  See the example code below. You will need your Branch Key from the Branch dashboard.
<commit_msg>Update 1_intro.md<commit_after># Full Documentation for Cordova SDK

This documentation outlines the functionality of the Branch Metrics Cordova SDK, and how to easily incorporate it into a Cordova app. The Cordova SDK shares the same code base as the Branch Web SDK, and includes functions to call all of the same API endpoints.

Live demo of the Web SDK: [https://cdn.branch.io/example.html](https://cdn.branch.io/example.html)

To use the Cordova SDK, you'll need to first initialize it with your Branch Key found in your [Branch dashboard](https://dashboard.branch.io/#/settings). You'll also need to register when your users login with `setIdentity`, and when they logout with `logout`.

### Register you app

You can sign up for your own Branch Key at [https://dashboard.branch.io](https://dashboard.branch.io)

### Quick Install of Cordova/Phonegap SDK

This Web SDK can also be used for Cordova/Phonegap applications.  It is provided as a plugin and can be installed with Cordova plugin or the Plugman tool.  Point the tool at this repositry, https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK.  For example:

```sh
cordova plugin add https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK
```

Note that this SDK is meant for use with full Cordova/PhoneGap apps.  If you are building a hybrid app using an embedded web view and you want to access the Branch API from native code you will want to use the platform specific SDKs and pass data into Javascript if needed.

### Running Cordova Testbed App
This repo includes a sample app, that demonstrates all of the available methods in the Branch Cordova SDK.
Building this app is very simple:

Switch to the Cordova dir
```js
$ cd cordova-testbed
```

Run the init script to install all the required plugins
```js
$ ./init.sh
```

Build the Cordova app and launch in the iOS emulator
```sh
$ cordova emulate ios
```

#### Initialization and Event Handling

You should initialize the Branch SDK session once the ‘deviceready’ event fires and each time the ‘resume’ event fires.  See the example code below. You will need your Branch Key from the Branch dashboard.

{'fraction_non_alphanumeric': 0.06968721251149954, 'fraction_numerical': 0.00022999080036798528, 'mean_word_length': 4.349323493234932, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2936704', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1144, 'n_words': 610}