| 62 | let ci; |
| 63 | |
| 64 | export function initAnalytics() { |
| 65 | if (!ciActive) { |
| 66 | return; |
| 67 | } |
| 68 | store = new BrowserStoreWithKV(); |
| 69 | ci = new CleanInsights({ |
| 70 | 'server': 'https://metrics.cleaninsights.org/cleaninsights.php', |
| 71 | 'siteId': 22, |
| 72 | 'persistEveryNTimes': 1, |
| 73 | 'campaigns': { |
| 74 | [ONBOARDING_CAMPAIGN]: { |
| 75 | 'start': '2024-03-01T00:00:00-00:00', |
| 76 | 'end': '2024-12-31T23:59:59-00:00', |
| 77 | 'aggregationPeriodLength': 1, // days |
| 78 | 'numberOfPeriods': 30, |
| 79 | }, |
| 80 | } |
| 81 | }, store); |
| 82 | // By calling this when the extension is initialized, we can make sure we flush the last events out. |
| 83 | ci.persistAndSend(); |
| 84 | } |
| 85 | |
| 86 | export function binInto10sIncrements(milliseconds) { |
| 87 | return Math.floor(milliseconds / (10 * 1000)) * 10; |