0.0.3 • Published 3 years ago

ngx-jixie-analytics v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Ngx Jixie Analytics

This package is a library for integrate jixie analytics in your angular project and inspired by angular-tag-manager.

Getting Started

In your Angular project run

npm i --save ngx-jixie-analytics

After installing it you need to provide your account id:

providers: [
    ...
    {
        provide: 'jixieAccountId',  
        useValue: YOUR_ACCOUNT_ID
    }
]

Or use the module's forRoot method

import { 
    NgxJixieAnalyticsModule 
} from 'ngx-jixie-analytics';

imports: [
    ...
    NgxJixieAnalyticsModule.forRoot({
      accountid: YOUR_ACCOUNT_ID,
    })
]

inject the analyticService in your controller

constructor(
    ...
    private analyticService: JixieAnalyticService,
) { }

then you can start pushing events on your jixie:

const jixieTag = {
  // accountid automatically added when `pushTag`.
  email: user.email ?
    this.analyticService.hash(user.email) : '',
  action: "viewitem",
  parameters:{
      itemid:"54fg4",
      price:"23.21",
      currency:"USD",
      availability: "instock"
  }
};

this.analyticService.pushTag(jixieTag);

if you want to receive tags without pushing events simply call the function to enable it

this.analyticService.addJixieToDom();

Authors