Skip to content

Commit

Permalink
Merge branch 'main' into feat/useStorageForBrowsers
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Jan 19, 2023
2 parents a82c0f6 + 523a5c4 commit 0524e74
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.1.1](https://github.com/ipfs-shipyard/ignite-metrics/compare/v1.1.0...v1.1.1) (2023-01-18)


### Bug Fixes

* 500/1000 event-queue split ([5744297](https://github.com/ipfs-shipyard/ignite-metrics/commit/5744297c941bdf6912b41a2c4569444b92fe8203))

## [1.1.0](https://github.com/ipfs-shipyard/ignite-metrics/compare/v1.0.3...v1.1.0) (2023-01-18)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ipfs-shipyard/ignite-metrics",
"version": "1.1.0",
"version": "1.1.1",
"description": "UI library for gathering metrics for ignite team projects",
"author": "Ignite Team",
"license": "Apache-2.0 OR MIT",
Expand Down
25 changes: 15 additions & 10 deletions src/MetricsProvider.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { COUNTLY_API_URL } from './config.js'
import { COUNTLY_SETUP_DEFAULTS } from './config.js'

import type { metricFeatures, CountlyWebSdk } from 'countly-sdk-web'
import type { CountlyNodeSdk } from 'countly-sdk-nodejs'
import type { consentTypes, consentTypesExceptAll, StorageProvider } from './types/index.js'

export interface MetricsProviderConstructorOptions<T> {
appKey: string
url?: string
autoTrack?: boolean
interval?: number
max_events?: number
queue_size?: number
session_update?: number
url?: string
metricsService: T
storageProvider?: StorageProvider | null
}
Expand All @@ -25,13 +30,12 @@ export default class MetricsProvider<T extends CountlyWebSdk | CountlyNodeSdk> {
private readonly metricsService: T
private readonly storageProvider: StorageProvider | null

constructor ({
autoTrack = true,
url = COUNTLY_API_URL,
appKey,
metricsService,
storageProvider
}: MetricsProviderConstructorOptions<T>) {
constructor (config: MetricsProviderConstructorOptions<T>) {
const serviceConfig = {
...COUNTLY_SETUP_DEFAULTS,
...config
}
const { appKey, autoTrack, metricsService, url, storageProvider } = serviceConfig
this.metricsService = metricsService
this.storageProvider = storageProvider ?? null
this.metricsService.init({
Expand All @@ -40,9 +44,10 @@ export default class MetricsProvider<T extends CountlyWebSdk | CountlyNodeSdk> {
require_consent: true
})

this.metricsService.init(serviceConfig)
this.metricsService.group_features(this.groupedFeatures)

if (autoTrack) {
if (autoTrack === true) {
this.setupAutoTrack()
}

Expand Down
8 changes: 8 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
export const COUNTLY_API_URL = 'https://countly.ipfs.tech'
export const COUNTLY_SETUP_DEFAULTS = {
url: COUNTLY_API_URL,
autoTrack: true,
interval: 5000,
max_events: 500,
queue_size: 1000,
session_update: 60
}

0 comments on commit 0524e74

Please sign in to comment.