import { Injectable } from '@angular/core' ; import { Angulartics2 } from '../../angulartics2-core' ; declare const _satellite ; @ Injectable ( { providedIn : 'root' } ) export class Angulartics2LaunchByAdobe { payload : any = { } ; constructor ( protected angulartics2 ) { if ( 'undefined' === typeof _satellite ) { console . warn ( 'Launch not found!' ) ; } this . angulartics2 . setUsername . subscribe ( ( x ) => this . setUsername ( x ) ) ; this . angulartics2 . setUserProperties . subscribe ( x => this . setUserProperties ( x ) ) ; } setUsername ( userId ) { if ( 'undefined' !== typeof userId && userId ) { this . payload . userId = userId ; } } setUserProperties ( properties ) { if ( 'undefined' !== typeof properties && properties ) { this . payload . properties = properties ; } } startTracking ( ) { this . angulartics2 . pageTrack . pipe ( this . angulartics2 . filterDeveloperMode ( ) ) . subscribe ( x => this . pageTrack ( x . path ) ) ; this . angulartics2 . eventTrack . pipe ( this . angulartics2 . filterDeveloperMode ( ) ) . subscribe ( x => this . eventTrack ( x . action , x . properties ) ) ; } pageTrack ( path ) { this . payload = this . payload || { } ; this . payload . path = path ; if ( 'undefined' !== typeof _satellite && _satellite ) { _satellite . track ( 'pageTrack' , this . payload ) ; } } param action param properties eventTrack ( action , properties ) { properties = properties || { } ; this . payload . action = action ; this . payload . eventProperties = properties ; if ( 'undefined' !== typeof _satellite && _satellite ) { _satellite . track ( 'eventTrack' , this . payload ) ; } } }