1.0.0-beta03 • Published 2 years ago

react-native-test-e-learn v1.0.0-beta03

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Benshi React Native (Android) SDK Setup - E-Learning

Benshi Android SDK E-Learning module consists of events for online learning platforms. You need to implement this module if your app offers learning content that may include learning content, viewing courses, attempting exams or to pass an exam to get certified. In order to use the e-learning ,module you need to include the following dependency in your app level build.gradle but make sure you have core module already integrated.

This documentation covers the steps to integrating SDK in your react native (android) apps. We’ll also discuss a few fundamentals of how the dashboard works in tandem with your app usage to view your users and engage them with contextually personalized messages.

Getting Started

In order to use the SDK, Core is mandatory to include as it contains the elements regarding the basic app navigation and workflow including nudges. Moreover, all the modules requires Core to be integrated in order to successfully log the events.

The easiest way to integrate Benshi react native (android) SDK in your project is using an NPM package. Add dependencies of react native SDK in the dependencies section of your package.json of your project and Android Lifecycle Components in the app/build.gradle file.

"dependencies": {
    "@benshi.ai/react-native-bsh-e-learn": "<version number>"
  },

After including the above, Open terminal/shell and go to your project directory and run:

npm install

This will install the e-learn npm package in your node mosules of your project. Now you need to link this module with your android app, for this in the same terminal in your project directory run:

react-native link @benshi.ai/react-native-bsh-e-learn

This will link your newly added module with your android app and you can also see the link in your andorid settings.gradle file. To add the dependecy, open your andorid folder in Android Studio and open app level build.gradle file. now in your dependencies add the following:

dependencies {

  implementation project(path: ':@benshi.ai_react-native-bsh-e-learn')

}
Please note that this package required you to already installed and linked `react-native-bsh-core` package in your app or else the ogs will not be tirggered.

## Tracking System Events

We have several pre-defined actions that users can perform while interacting with your app. These actions are referred to as System Events that help in tracking elements on your app with user interaction.

Here's a list of System Events that can be tracked using e-learning module:

| Event Name | Calling in SDK  | Description                                                      |
| ---------- | --------------- | ---------------------------------------------------------------- |
| [Module](#module-event)       | EventType.module  | Track user interactions e-learning modules inside the app. |
| [Exam](#exam-event)      | EventType.exam | Track user interaction with the exam, when they start, submit or retake the exam.         |
| [Question](#question-event)      | EventType.question | Track user interaction with questions or quiz inside the app, what answers they choose.          |

To log E-learning Events you need to import ELearn main class and contants to support different actions:

```js
import {BsELearn, ModuleLogType, ModuleLogAction, ExamAction} from '@benshi.ai/react-native-bsh-e-learn';

Here BsELearn is the main class for all the core related events to help you imlepment logs in a function approach. while rest are contant classes to help you with actions for different logs. You can also pass strings instead of these contant values but the params shouls be same as provided in contants or else the log will not be triggered and an exception will be thrown by the SDK. BsELearn class contains a list of functions in the core module and every function has 2 extra params to help you, you can include them in the parent functions, one is meta whoch you can use to pass data you want to the SDK but remember to pass it in as key-value pair and convert that to JSON string so that it may be parsed with the rest of the SDK content. the last parm is the updateImmediately boolean which helps you to send a specific log as soon as it happens as by default SDK logs the events at the end of the session in a batch.

Examples for above-mentioned events with both approaches are given below:

Module Event

To log user interactions with the app when a user views a module. To log actions related to e-learning modules which includes the log for user viewing the module, starting and finishing the module and also user viewing the content page as well.

@param moduleId string type refers to the module id for which the user is viewing. @param logType enum for the type of content user is seeing, can be description or the ontent page for the module, possible values are: description and content. @param elementName is the name of the module user id viewing, can be the name of the inner module, contentList as well @param action enum for the type of action user is performing on the module. possible values are: view, start and finish.

BsELearn.logModuleEvent("moduleId", ModuleLogType.description, "Covid-19", ModuleLogAction.start)

ModuleLogType is required to set the log type for the module event. It is used to log the type of content the user is being provided. SDK provides enum ModuleLogType to support available log types.

description // for viewing desctiption about the module
content // for viewing content of the module

ModuleAction is required to set the Action type for the module event. SDK provides enum classes to support available log types. SDK provides enum ModuleLogAction to support available log types.

view // for viewing a module element
start // for starting the module
finish // for finishing the module

Exam Event

To log actions related to e-learning module exams. which includes the related to starting, retaking, reviewing and submit the exam. This also updates the user score and whether they passed the exam or not.

@param examId string type, used to log the test user is attempting. @param action enum is the action performed y the user on the test, possible values are start, submit, review and retake. @param score is required if there is some score provided ot the user in result of the exam submitted. this is required in case of examAction been submit. @param is_passed is required if the user passed or failed the exam. This log is required only in case when examAction is submit.

BsELearn.logExamEvent("examId", ExamAction.submit, 80, true) // 80 is the score while true is for is_passed

ExamAction is required to set the Action type for the exam event. SDK provides enum class ExamAction to support available log types.

start // for loging start of exam
submit // for loging submission of exam
review // for loging review of exam
retake // for loging retaking of exam

Question Event

To log this event you need to provide the question Id that User has attempted and also the id for the answer the user has selected.

@param questionId string type is used to log question user is attempting. @param answerId string type, represents answer user is selecting.

 BsELearn.logQuestionEvent("questionId", "answerId")

For implementation, you can also view the dmeo app.

Guidelines

  • Including lifecycle components is required in order to use the Sdk as SDK requires lifecycle components to listen for app events regarding app sessions and app moving to background.
  • Anything you include in the meta will be sent to the backend and be visible in the log monitoring section, but it will not be processed.
  • Custom Event Attributes can be of these data types: String, Number, Boolean, Date, List, Map.
  • Make sure to include your SDK key in the manifest of your Android App so that SDK can have that while initialization or else it would through an IllegalAccessException.
  • Make sure to initialise the SDK in the Applicaion class or else if you trigger SDK events without that it will through RuntimeException.
  • updateImmediately is an optional param, by default its value is true. You can decide for each event if it needs to be updated immediately, or it can wait until the end of the app session.
  • Please ensure consistent usage of the names of Custom Events in meta and their Custom Attributes across all your apps (Android, iOS) and website.
  • Please use the same name conventions as provided by the enums if you choose to pass strings as values or else the event will be discarded and an IllegalArgumentException will be thrown.

Please feel free to drop in a few lines at support@benshi.ai in case you have any further queries. We're always just an email away!

1.0.0-alpha22.1

2 years ago

1.0.0-beta03

2 years ago

1.0.0-alpha23

2 years ago

1.0.0-alpha22

2 years ago

1.0.0-alpha21

2 years ago

1.0.0-alpha20

2 years ago

1.0.0-alpha19

2 years ago

1.0.0-alpha18

2 years ago

1.0.0-alpha17

2 years ago

1.0.0-alpha16

2 years ago

1.0.0-alpha15

2 years ago

1.0.0-alpha14

2 years ago

1.0.0-alpha13

2 years ago

1.0.0-alpha12

2 years ago

1.0.0-alpha11

2 years ago

1.0.0-alpha10

2 years ago

1.0.0-alpha09

2 years ago

1.0.0-alpha08

2 years ago

1.0.0-alpha06

2 years ago

1.0.0-alpha05

2 years ago

1.0.0-alpha04

2 years ago

1.0.0-alpha03

2 years ago

1.0.1-alpha01

2 years ago