All Projects → Arnaud73 → ngx-matomo

Arnaud73 / ngx-matomo

Licence: MIT license
Matomo (aka. Piwik) web analytics for Angular applications

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to ngx-matomo

Matomo
Liberating Web Analytics. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. We love Pull Requests!
Stars: ✭ 15,711 (+18828.92%)
Mutual labels:  web-analytics, piwik, matomo
matomo-for-wordpress
Get a fully functioning Matomo Analytics for your WordPress. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Privacy is built-in. 100% data ownership, no one else can see your data. We love Pull Requests!
Stars: ✭ 90 (+8.43%)
Mutual labels:  piwik, matomo
nodejs-piwik
Access a Matomo (Piwik) API from node.js
Stars: ✭ 37 (-55.42%)
Mutual labels:  piwik, matomo
matomo-mediawiki-extension
www.mediawiki.org/wiki/Extension:Piwik_Integration
Stars: ✭ 18 (-78.31%)
Mutual labels:  piwik, matomo
gatsby-plugin-matomo
🥂 Gatsby plugin to add Matomo (formerly Piwik) onto a site.
Stars: ✭ 56 (-32.53%)
Mutual labels:  piwik, matomo
hugo-component-matomo
Matomo user tracking and optout scripts for Hugo
Stars: ✭ 38 (-54.22%)
Mutual labels:  piwik, matomo
matomo-tracker
Stand alone library for using matamo tracking in frontend projects
Stars: ✭ 138 (+66.27%)
Mutual labels:  piwik, matomo
matomo-next
Matomo for Next.js applications
Stars: ✭ 87 (+4.82%)
Mutual labels:  matomo
wht
Working Hours Tracker for Sailfish OS
Stars: ✭ 20 (-75.9%)
Mutual labels:  tracker
mailbox
📨 簡易電子報發送系統,使用 #Golang 實作,send campaign mail with open, click tracker.
Stars: ✭ 26 (-68.67%)
Mutual labels:  tracker
flutter page tracker
flutter埋点、弹窗埋点、页面埋点事件捕获框架,支持普通页面的页面曝光事件(PageView),页面离开事件(PageExit)。支持在TabView和PageView组件中发送页面曝光和页面离开
Stars: ✭ 103 (+24.1%)
Mutual labels:  tracker
MySB
MySB (MySeedBox) is more than a simplified installation script of a multi-users Seedbox. There are many solutions to install a Seedbox, but we never talk about safety and regular operations. MySB could be renamed MySSB (MySecuredSeedBox).
Stars: ✭ 105 (+26.51%)
Mutual labels:  tracker
Expense Tracker with Pdf report
An expense Tracker 🔥🔥 which lets you add transactions 🖊🖊 and generate a pdf report of all of your transactions📋📋
Stars: ✭ 16 (-80.72%)
Mutual labels:  tracker
trackingco.de
minimal and loginless web analytics
Stars: ✭ 32 (-61.45%)
Mutual labels:  web-analytics
analytics
A Flarum extension that provides your forum piwik's and google's analytics features
Stars: ✭ 32 (-61.45%)
Mutual labels:  piwik
covid-19-tracker
Covid 19 tracker is created using React JS. This tracker aims to show the numbers & trends of people affected, recovered and deceased due to COVID-19.
Stars: ✭ 23 (-72.29%)
Mutual labels:  tracker
time-tracker-cli
Super tiny and ligthway time tracker for all cli lovers
Stars: ✭ 79 (-4.82%)
Mutual labels:  tracker
fastdfs
fastdfs集成环境
Stars: ✭ 19 (-77.11%)
Mutual labels:  tracker
scrapeer
Essential PHP library that scrapes HTTP(S) and UDP trackers for torrent information.
Stars: ✭ 81 (-2.41%)
Mutual labels:  tracker
vue-analytics-facebook-pixel
A small wrapper around Facebook Pixel API
Stars: ✭ 23 (-72.29%)
Mutual labels:  web-analytics

ngx-Matomo

GitHub stars Build Status (GitHub) Build Status (Travis) NPM version Codacy Badge Conventional Commits MIT license

Wrapper for Matomo (aka. Piwik) analytics tracker for Angular applications.

Choose the version corresponding to your Angular version:

Angular ngx-matomo
14+ 1.x
13 not available
9 to 12 1.0.0-rc1
5 to 8 0.x

Installation

Use npm or yarn to add the module to your current project:

npm install --save ngx-matomo

or

yarn add ngx-matomo

Using ngxMatomo

Injecting the tracker

In order to add Matomo capabilities to your application, you need to import MatomoModule into your root NgModule.

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { MatomoModule } from 'ngx-matomo';

import { AppComponent } from './app.component';

@NgModule({
  imports: [
    BrowserModule,
    ...
    MatomoModule.forRoot({
      scriptUrl: '//matomo.example.com/matomo.js',
      trackers: [
        {
          trackerUrl: 'http://matomo.example.com/matomo.php',
          siteId: 1
        }
      ],
      routeTracking: {
        enable: true
      }
    }),
    ...
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule { }

If you are using an old version of Matomo (3.x or less), please add scriptVersion with the version number (2, 3, 4…) to the configuration object passed the the MatomoModule.forRoot() function. This will activate some features present in Matomo 3 that were deprecated in Matomo 4.

Customizing tracking

Once that's done you can import MatomoTracker into any component of your application.

import { Component } from '@angular/core';
import { MatomoTracker } from 'ngx-matomo';

@Component({
  selector: 'app-root',
  template: `<router-outlet></router-outlet>`,
})
export class AppComponent {
  constructor(private matomoTracker: MatomoTracker) {}

  ngOnInit() {
    this.matomoTracker.setUserId('UserId');
    this.matomoTracker.setDocumentTitle('ngxMatomo Test');
  }
}

Then, let's find an action you would like to track:

<button (click)="whatHappensOnClick($event)"></button>

Just add the MatomoTracker to your component and use the trackEvent function.

import { Component } from '@angular/core';
import { MatomoTracker } from 'ngx-matomo';

@Component({
  selector: 'app-my',
  templateUrl: './myButton.html',
})
export class MyComponent {
  constructor(private matomoTracker: MatomoTracker) {}

  whatHappensOnClick(someVal) {
    /*
     * some code...
     */
    this.matomoTracker.trackEvent('category', 'action', 'name', someVal);
  }
}

Migrating from earlier versions (0.x)

ngxMatomo 1.0 is a major evolution from previous versions. If you plan migrating from a previous release, follow the next steps:

  • Remove any Matomo injection script in your index.html if you chose to inject the tracker this way.
  • Remove any use of MatomoInjector in your code if you chose to inject the tracker this way.
  • Import the MatomoModule with MatomoModule.forRoot() call and provide a MatomoConfiguration object so that the tracker is correctly injected into your application.
  • Decide if you want to take advantage of the newly added features (route tracking, consent management) and update you configuration accordingly.

Original Source

This module is inspired from Angular2Piwik, which was also inspired from Angulartics 2.

License

MIT

See also

Matomo's site has the detailed documentation on how to use Matomo and integrate it in an application. See also:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].