AnalyticsService
Extends:
Service handling Analytics calls with specific endpoints.
Method Summary
| Public Methods | ||
| public |
getCurrent(): Promise<any> Gets the current location using the browser navigator.geolocation.getCurrentPosition method |
|
| public |
getMetrics(params: Object, cacheMode: String): Promise<AnalyticsMetric> |
|
| public |
postInsights(action: String, section: String, value: String, label: String, triggeredAt: String, brandId: String, location: Object): Promise<any> Posts insights tracking to the Clinical6 platform |
|
Inherited Summary
| From class AbstractService | ||
| public get |
|
|
| public set |
|
|
| public |
|
|
| private |
|
|
| From class JsonApiService | ||
| public |
options: * |
|
| public |
Call a DELETE request on the main obj.type expecting JSON API information. |
|
| public |
Call a GET request expecting JSON API information. |
|
| public |
async getChildren(parent: Object, child: Object, options: String): Promise Call a GET request expecting JSON API information for children given a parent. |
|
| public |
Call a POST request on the main obj.type expecting JSON API information. |
|
| public |
Call a PATCH request on the main obj.type expecting JSON API information. |
|
Public Methods
public getCurrent(): Promise<any> source
Gets the current location using the browser navigator.geolocation.getCurrentPosition method
public getMetrics(params: Object, cacheMode: String): Promise<AnalyticsMetric> source
Throw:
If missing token or missing required parameters |
Example:
import { analyticsService } from 'clinical6';
// You will be able to access these analyticsMetrics using the `getMetrics` method. You must
// provide the name of the analyticMetric
analyticsService.getMetrics({ name: 'accepted_users' }).then(analyticsMetric => console.log(analyticsMetric));
public postInsights(action: String, section: String, value: String, label: String, triggeredAt: String, brandId: String, location: Object): Promise<any> source
Posts insights tracking to the Clinical6 platform
Params:
| Name | Type | Attribute | Description |
| action | String |
|
The action that triggers the track insights event, |
| section | String |
|
The section of the application that triggers the application, |
| value | String |
|
The specific element Id for the given section to track. |
| label | String |
|
The name/text the user sees for the value being tracked. |
| triggeredAt | String |
|
The timestamp for when the event occurred. If this parameter is not found, it defaults to the timestamp of the request, |
| brandId | String |
|
The brand associated with the section/value, |
| location | Object |
|
Object including the following location-based fields |
| location.latitude | Float |
|
latitude in the location |
| location.longitude | Float |
|
longitude in the location |
Throw:
If missing token or missing required parameters |
Example:
import { analyticsService } from 'clinical6';
analyticsService.postInsights('save', 'Acronyms');
analyticsService.postInsights('save', 'Acronyms');
analyticsService.postInsights('save', 'Acronyms', 'value23', 'label', 53,
{latitude: 53.20483, longitude: 78.2840});
Manual
Reference
Source
Test
