Giter Club home page Giter Club logo

ng-log-firebase-analytics's Introduction

Angular Firebase Analytics Integration for NG-LOG

GitHub Actions Status Azure Pipelines Status npm version Gitter

Google Firebase Analytics integration of DagonMetric/ng-log for Angular applications.

Getting Started

Installation

npm

npm install @dagonmetric/ng-log @dagonmetric/ng-log-firebase-analytics

or yarn

yarn add @dagonmetric/ng-log @dagonmetric/ng-log-firebase-analytics

Module Setup (app.module.ts)

import { LogModule } from '@dagonmetric/ng-log';
import { FirebaseAnalyticsLoggerModule } from '@dagonmetric/ng-log-firebase-analytics';

@NgModule({
  imports: [
    // Other module imports

    // ng-log modules
    LogModule,
    FirebaseAnalyticsLoggerModule.configure({
      firebaseConfig : {
          apiKey: '<your_firebase_app_api_key>',
          projectId: '<your_firebase_project_id>',
          appId: '<your_firebase_app_id>',
          // Replace 'G-1111111111' with your measurementId
          measurementId: 'G-1111111111',
          // ...
      }
    })
  ]
})
export class AppModule { }

Live edit app.module.ts in stackblitz

Usage (app.component.ts)

import { Component, OnInit } from '@angular/core';

import { LogService } from '@dagonmetric/ng-log';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
  constructor(private readonly logService: LogService) { }

  ngOnInit(): void {
    // Track traces
    this.logService.trace('Testing trace');
    this.logService.debug('Testing debug');
    this.logService.info('Testing info');
    this.logService.warn('Testing warn');

    // Track exceptions
    this.logService.error(new Error('Testing error'));
    this.logService.fatal(new Error('Testing critical'));

    // Track page view
    this.logService.trackPageView({
      name: 'My Angular App',
      uri: '/home'
    });

    // Track page view with timing
    this.logService.startTrackPage('about');
    this.logService.stopTrackPage('about', { uri: '/about' });

    // Track custom event
    this.logService.trackEvent({
      name: 'video_auto_play_start',
      properties: {
        non_interaction: true
      }
    });

    // Track custom event with metrics
    this.logService.trackEvent({
      name: 'foo',
      custom_map: {
        dimension2: 'age',
        metric5: 'avg_page_load_time'
      },
      measurements: {
        avg_page_load_time: 1
      },
      properties: {
        age: 12
      }
    });

    // Track custom event with timing
    this.logService.startTrackEvent('video_auto_play');
    this.logService.stopTrackEvent('video_auto_play', {
      properties: {
        non_interaction: true
      }
    });

    // Set user properties
    this.logService.setUserProperties('<Authenticated User Id>', '<Account Id>');

    // Clear user properties
    this.logService.clearUserProperties();
  }
}

Live edit app.component.ts in stackblitz

Samples

Related Projects

  • ng-log - Vendor-agnostic logging, analytics and telemetry service abstractions and some implementations for Angular applications
  • ng-log-applicationinsights - Microsoft Azure Application Insights implementation for ng-log
  • ng-log-gtag - Angular Google Analytics (gtag.js) logger implementation for ng-log
  • ng-log-facebook-analytics - Facebook Pixel Analytics implementation for ng-log

Feedback and Contributing

Check out the Contributing page.

License

This repository is licensed with the MIT license.

ng-log-firebase-analytics's People

Contributors

dagonmetric-contributor avatar mmzliveid avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

mmzliveid asuka48

ng-log-firebase-analytics's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update dependency @types/jasminewd2 to ^2.0.13
  • Update dependency firebase to ^8.10.1
  • Update dependency @types/node to ^16.18.97
  • Update dependency eslint-plugin-jsdoc to ^37.9.7
  • Update dependency eslint-plugin-prettier to ^4.2.1
  • Update dependency jasmine-core to ^3.99.1
  • Update dependency ts-node to v10.9.2
  • Update dependency tslib to ~2.6.2
  • Update dependency zone.js to ^0.14.6
  • Update dependency @types/jasmine to v5
  • Update dependency @types/node to v20
  • Update dependency eslint to v9
  • Update dependency eslint-config-prettier to v9
  • Update dependency eslint-plugin-jsdoc to v48
  • Update dependency eslint-plugin-prettier to v5
  • Update dependency firebase to v10
  • Update dependency jasmine-core to v5
  • Update dependency prettier to v3
  • Update dependency typescript to v5
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • @angular/common ^11.2.14
  • @angular/core ^11.2.14
  • @dagonmetric/ng-log ^2.3.3
  • firebase ^8.10.0
  • rxjs ^6.6.7
  • tslib ~2.3.1
  • @angular-devkit/build-angular ^12.2.14
  • @angular/cli ^11.2.15
  • @angular/compiler ^11.2.14
  • @angular/compiler-cli ^11.2.14
  • @angular/language-service ^11.2.14
  • @angular/platform-browser ^11.2.14
  • @angular/platform-browser-dynamic ^11.2.14
  • @types/jasmine ^3.10.2
  • @types/jasminewd2 ^2.0.10
  • @types/node ^16.11.12
  • @typescript-eslint/eslint-plugin ^4.33.0
  • @typescript-eslint/parser ^4.33.0
  • eslint ^7.32.0
  • eslint-config-prettier ^7.2.0
  • eslint-plugin-jsdoc ^37.1.0
  • eslint-plugin-prettier ^4.0.0
  • jasmine-core ^3.10.1
  • lib-tools ^2.0.4
  • prettier ^2.2.1
  • protractor ~7.0.0
  • ts-node ^10.5.0
  • tsickle ^0.39.1
  • typescript 4.1.5
  • zone.js ^0.11.4
samples/demo-app/package.json
  • @angular/animations 11.2.14
  • @angular/common ^11.2.14
  • @angular/compiler 11.2.14
  • @angular/core ^11.2.14
  • @angular/forms ^11.2.14
  • @angular/platform-browser ^11.2.14
  • @angular/platform-browser-dynamic ^11.2.14
  • @angular/router ^11.2.14
  • @dagonmetric/ng-log ^2.3.3
  • @dagonmetric/ng-log-firebase-analytics ^2.1.3
  • firebase ^8.10.0
  • rxjs ^6.6.7
  • tslib ~2.3.1
  • zone.js ^0.11.4
  • @angular-devkit/build-angular ^12.2.14
  • @angular/cli ^11.2.15
  • @angular/compiler-cli ^11.2.14
  • @angular/language-service ^11.2.14
  • @types/node ^16.11.12
  • ts-node ~10.5.0
  • typescript ~4.1.5

  • Check this box to trigger a request for Renovate to run again on this repository

Doesn't seem to be compatible with angular 16

`Error: src/app/app.module.ts:13:12 - error NG6002: 'FirebaseAnalyticsLoggerModule' does not appear to be an NgModule class.

13 imports: [
~
14 BrowserModule,
~~~~~~~~~~~~~~~~~~
...
25 }})
~~~~~~~~~
26 ],
~~~

../../../../../../node_modules/@dagonmetric/ng-log-firebase-analytics/src/firebase-analytics-logger.module.d.ts:15:22
15 export declare class FirebaseAnalyticsLoggerModule {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This likely means that the library (@dagonmetric/ng-log-firebase-analytics) which declares FirebaseAnalyticsLoggerModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

Error: src/app/app.module.ts:15:5 - error NG6002: 'LogModule' does not appear to be an NgModule class.

15 LogModule,
~~~~~~~~~

../../../../../../node_modules/@dagonmetric/ng-log/src/log.module.d.ts:13:22
13 export declare class LogModule {
~~~~~~~~~
This likely means that the library (@dagonmetric/ng-log) which declares LogModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

`

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.