# @santech/analytics-integration

> Analytics integration for santech studio

Latest version **7.0.0-beta.4** (published 2019-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @santech/analytics-integration
pnpm add @santech/analytics-integration
yarn add @santech/analytics-integration
bun add @santech/analytics-integration
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 7.0.0-beta.4 |
| Published | 2019-02-06 |
| First published | 2018-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 402.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Paul Souche |
| Maintainers | outilssantech |
| Keywords | santech, studio, analytics, integration |

## Links

- npm: https://www.npmjs.com/package/@santech/analytics-integration
- Repository: https://github.com/santech-org/studio
- Homepage: https://github.com/santech-org/studio#readme
- Issues: https://github.com/santech-org/studio/issues
- npm.io page: https://npm.io/package/@santech/analytics-integration

## Dependencies (3)

- [@santech/core](https://npm.io/package/@santech/core.md) ^7.0.0-beta.4
- [@santech/common](https://npm.io/package/@santech/common.md) ^7.0.0-beta.4
- [@santech/analytics-core](https://npm.io/package/@santech/analytics-core.md) ^7.0.0-beta.4

## Recent versions

- 7.0.0-beta.4 (latest) — 2019-02-06
- 7.0.0-alpha.16 — 2019-02-06
- 7.0.0-beta.3 — 2018-11-15
- 7.0.0-alpha.15 — 2018-11-14
- 7.0.0-beta.2 — 2018-11-05
- 7.0.0-beta.1 — 2018-10-12
- 7.0.0-beta.0 — 2018-08-28
- 7.0.0-alpha.14 — 2018-08-23
- 7.0.0-alpha.13 — 2018-07-31
- 7.0.0-alpha.12 — 2018-07-24
- 7.0.0-alpha.11 — 2018-07-23
- 7.0.0-alpha.10 — 2018-06-26
- 7.0.0-alpha.9 — 2018-06-21
- 7.0.0-alpha.8 — 2018-06-02
- 7.0.0-alpha.7 — 2018-05-30
- … 7 more at https://npm.io/package/@santech/analytics-integration/versions

## README

@santech/analytics-integration
[![Dependency Status](https://david-dm.org/santech-org/studio/status.svg?path=%40santech%2Fanalytics-integration)](https://david-dm.org/santech-org/studio?path=%40santech%2Fanalytics-integration)
[![devDependency Status](https://david-dm.org/santech-org/studio/dev-status.svg?path=%40santech%2Fanalytics-integration)](https://david-dm.org/santech-org/studio?path=%40santech%2Fanalytics-integration&type=dev)
========

@santech/analytics-integration is a npm module that exports analytics integration of the santech studio

## Prerequisites

You need to have globally installed:

* node 9.x.x
* npm 5.x.x
* yarn 1.x.x

## Development

Install all the dependencies

```
yarn
```

Launch tests

```
yarn test
```

Build the package

```
yarn build
```

Publish the package

```
npm publish
```

## Require package in your project

```
npm i @santech/analytics-integration -S
```

Import module

```javascript
import { SantechIntegration } from '@santech/analytics-integration';
// or
var SantechIntegration = require('@santech/analytics-integration').SantechIntegration;
// or
var SantechIntegration = Santech.AnalyticsIntegration.SantechIntegration;
```

## Examples

Angular 1

```html
<script type="text/javascript" src="./node_modules/@santech/core/dist/umd/index.js"></script>
<script type="text/javascript" src="./node_modules/@santech/analytics-core/dist/umd/index.js"></script>
<script type="text/javascript" src="./node_modules/@santech/analytics-integration/dist/umd/index.js"></script>
```

```javascript
class MyCtrl {
  constructor() {
    Santech.AnalyticsCore.analytics.page();
  }
}

angular.module('santech', [])
  .constant('santech-endpoints', {
    publicEndPoint: 'your/backend/public-endpoint/api/version',
  })
  .service('santech-http', Santech.Core.Http)
  .service('santech-integration', ['santech-http','santech-endpoints', Santech.AnalyticsIntegration.SantechIntegration])
  .run(['santech-http', '$rootScope', function (http, $rootScope) {
    http.addResponseInterceptor(() => {
      $rootScope.$applyAsync();
    })
  }])
  .run(['santech-integration', function (santechIntegration) {
    analytics.add(santechIntegration);
    analytics.init();
  }]);
```

Angular 2

```typescript
import { InjectionToken, NgModule } from '@angular/core';
import { analytics } from '@santech/analytics-core';
import { SantechIntegration } from '@santech/analytics-integration';
import { CONFIG_END_POINTS, SantechCommonModule } from '@santech/angular-common';
import { SantechPlatformModule } from '@santech/angular-platform';
import { Http } from '@santech/core';

const ANALYTICS_OPTIONS = new InjectionToken<any>('analyticsOptions');

@NgModule({
  imports: [
    SantechPlatformModule.forRoot(),
    SantechCommonModule.forRoot({
      endPointsProvider: {
        provide: CONFIG_END_POINTS,
        useValue: {
          endPoint: 'endpoint/to/gateway',
          wsEndPoint: 'ws://host:port',
        },
      },
    }),
  ],
  providers: [
    {
      provide: SantechIntegration,
      useClass: SantechIntegration,
      deps: [Http, END_POINTS, ANALYTICS_OPTIONS],
    },
    {
      provide: ANALYTICS_OPTIONS,
      useValue: null,
    },
  ],
})
export class AppModule {
  constructor(integration: SantechIntegration) {
    analytics.add(integration);
    analytics.init();
  }
}
```

---
_Source: https://npm.io/package/@santech/analytics-integration · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
