패키지, 저장소 및 앱 카테고리 검색

패키지 상세v6.1.1

matomo_tracker

플러터용 완전한 크로스 플랫폼 Matomo 추적 클라이언트 래퍼, Matomo API를 사용합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
2.8만
좋아요
48
Pub 점수
130

패키지 설치

flutter pub add matomo_tracker

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

matomo_tracker 패키지는 Flutter 애플리케이션에 Matomo 분석을 완전히 크로스플랫폼으로 통합할 수 있는 솔루션을 제공합니다. 이 패키지는 Matomo 추적 API를 래핑하여 Android, iOS, 웹, macOS, Windows 및 Linux 플랫폼에서 사용자 행동 데이터를 수집할 수 있게 해줍니다. 간단한 초기화 및 이벤트 추적 메서드를 통해 사용자 정의 이벤트, 페이지 보기 및 사용자 세션 추적을 지원합니다. 기존 Matomo 설치와 원활하게 통합되도록 설계되어 플랫폼별 코드 없이 신뢰할 수 있는 데이터 수집이 가능합니다. 개인정보 보호 중심의 추적 방식을 유지하면서도 상세한 분석이 필요한 앱에 적합합니다.

사용 사례

  • 모바일 및 웹 앱에서 사용자 상호작용 추적
  • 페이지 뷰를 통한 앱 성능 모니터링
  • 사용자 행동 분석을 위한 사용자 지정 이벤트
  • 자체 호스팅된 Matomo 서버와의 통합
  • 다중 플랫폼에 걸쳐 분석 수집

주요 기능

  • 크로스 플랫폼 호환성
  • 주요 OS 플랫폼 전반에 대한 지원
  • 간단한 이벤트 및 페이지 뷰 추적
  • 자체 호스팅된 Matomo 인스턴스와의 통합
  • 개인정보 보호를 고려한 데이터 처리

적합한 대상

  • 분석이 필요한 플러터 개발자
  • 자체 호스팅된 Matomo 사용 앱
  • 다중 플랫폼 추적을 필요로 하는 프로젝트
  • 사용자 행동 인사이트에 집중하는 팀
  • 제3자 분석 서비스를 피하는 개발자

고려 사항

  • 실행 중인 Matomo 서버가 필요합니다
  • 추적 ID의 올바른 구성이 필요합니다
  • 개인정보 보호 규정 준수를 요구할 수 있습니다
  • Matomo 고유 기능에 한정
  • 데이터 전송은 네트워크 가용성에 따라 달라집니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Matomo Tracker

Floating Dartists

Pub Version (including pre-releases) Matomo Integrations GitHub license Coverage Status

Forked from the package matomo by poitch.

A fully cross-platform wrap of the Matomo tracking client for Flutter, using the Matomo Tracking API.

Summary

Documentation

Supported Matomo Versions

This package (matomo_tracker v5.0.0) currently supports Matomo 4.X up to Matomo 5.X.

Getting Started

As early as possible in your application, you need to configure the Matomo Tracker to pass the URL endpoint of your instance and your Site ID.

await MatomoTracker.instance.initialize(
    siteId: siteId,
    url: 'https://example.com/matomo.php',
);

If you need to use your own Visitor ID, you can pass it at the initialization of MatomoTracker as is:

await MatomoTracker.instance.initialize(
    siteId: siteId,
    url: 'https://example.com/matomo.php',
    visitorId: '2589631479517535',
);

Note that this Visitor ID should not be confused with the User ID which is explained below!

Navigator Observers

The package provides you with two ways to track views:

MatomoGlobalObserver

To track views globally, you can add the MatomoGlobalObserver to your navigatorObservers:

MaterialApp(
    // ...
    navigatorObservers: [
        MatomoGlobalObserver(),
    ],
);

And your views will be tracked automatically for each route change.

TraceableClientMixin & TraceableWidget

Those are used if you want to only track some specific widgets. First, you will have to add matomoLocalObserver to your navigatorObservers:

MaterialApp(
    // ...
    navigatorObservers: [
        matomoLocalObserver,
    ],
);

To track views on a StatefulWidget simply add TraceableClientMixin on your State:

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with TraceableClientMixin {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Text('Hello World!'),
      ),
    );
  }

  @override
  String get actionName => 'Created HomePage'; // optional

  @override
  String get path => '/home'; // optional
}

If you are in a StatelessWidget you can use the TraceableWidget widget:

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  Widget build(BuildContext context) {
    return TraceableWidget(
      actionName: 'Created HomePage', // optional
      path: '/home', // optional
      child: Scaffold(
        appBar: AppBar(
          title: Text(title),
        ),
        body: Center(
          child: Text('Hello World!'),
        ),
      ),
    );
  }
}

You can also optionally call directly trackPageView or trackPageViewWithName to track a view.

For tracking goals and, events call trackGoal and trackEvent respectively.

A value can be passed for events:

MatomoTracker.instance.trackEvent(
    eventInfo: EventInfo(
        category: 'eventCategory',
        name: 'eventName',
        action: 'eventAction',
        value: 18,
    ),
);

Using userId

If your application uses authentication and you wish to have your visitors including their specific identity to Matomo, you can use the Visitor property userId with any unique identifier from your back-end, by calling the setVisitorUserId() method. Here's an example on how to do it with Firebase:

  String userId = auth.currentUser?.email ?? auth.currentUser!.uid;
  MatomoTracker.instance.setVisitorUserId(userId);

Opting Out

If you want to offer a way for the user to opt out of analytics, you can use the setOptOut() call.

MatomoTracker.instance.setOptOut(optout: true);

Using Dimensions

If you want to track Visit or Action dimensions you can either use the trackDimensions (if it's a Visit level dimension) or provide data in the optional dimensions param of trackEvent (if it's an Action level dimension):

MatomoTracker.instance.trackDimensions({
  'dimension1': '0.0.1'
});
MatomoTracker.instance.trackEvent(
    eventInfo: EventInfo(
        category: "eventCategory",
        action: "eventAction",
        name: "eventName",
        value: 18,
    ),
    dimensions: {'dimension2':'guest-user'}
);

You can similarly track dimensions on Screen views with:

MatomoTracker.instance.trackPageViewWithName(
    actionName: "Settings",
    path: "/settings",
    dimensions: {'dimension1': '0.0.1'}
);

The naming of the dimensions is important and explained in more detail in the documentation of trackDimensions.

Cookieless Tracking

If you want to use cookieless tracking, you can use the cookieless property in the initialize method.

await MatomoTracker.instance.initialize(
    siteId: siteId,
    url: 'https://example.com/matomo.php',
    cookieless: true,
);

When using cookieless tracking, the user_id won't be sent or saved locally.

Dispatching

Actions logged are not send to Matomo immediately, but are queued for a configurable duration (defaulting to 10 seconds) before beeing send in batch. A user could terminate your app while there are still undispatched actions in the queue, which by default would be lost. The queue can be configured to be persistent so that such actions would then be send on the next app launch. See the DispatchSettings class for more configuration options.

await MatomoTracker.instance.initialize(
    siteId: siteId,
    url: 'https://example.com/matomo.php',
    dispatchSettings: const DispatchSettings.persistent(),
);

Migration Guide

v6.0.0

  • matomoObserver has been deprecated and will be removed in the next major version. You should now use matomoLocalObserver.
Before
MaterialApp(
    // ...
    navigatorObservers: [
        matomoObserver,
    ],
);
After
MaterialApp(
    // ...
    navigatorObservers: [
        matomoLocalObserver,
    ],
);

v5.0.0

  • Session class and its related properties firstVisit, lastVisit and visitCount have been removed as they were not used since Matomo 4.0.0.
  • LocalStorage methods getFirstVisit, setFirstVisit, getVisitCount and setVisitCount have been removed accordingly.
  • siteId is now a String instead of an int

v4.0.0

  • trackScreen was renamed to trackPageView and trackScreenWithName to trackPageViewWithName.
  • screenId and widgetId were renamed to pvId.
  • userId was renamed to uid.
  • traceName and widgetName were renamed to actionName.
  • traceTitle was renamed to eventName.
  • forcedId property has been removed as it was never used. You should rely on the user ID instead.
  • An object of type EventInfo has been added, it has the following properties: category, action, name and value, use it instead of passing the event name, action and value as separate parameters.
  • For TraceableClientMixin and TraceableWidget to work you will have to add the matomoObserver to your MaterialApp or WidgetsApp:
MaterialApp(
    // ...
    navigatorObservers: [
        matomoObserver,
    ],
);
  • MatomoEvent has been renamed to MatomoAction
  • trackPageView positional parameter context is now a named parameter
  • trackGoal positional parameter goalId is now a named parameter: id
  • trackDimensions positional parameter dimensions is now a named parameter
  • trackCartUpdate positional parameters trackingOrderItems, subTotal, taxAmount, shippingCost and discountAmount are now named parameters
  • trackOrder positional parameters orderId (now id), trackingOrderItems, revenue (also became a double), subTotal, taxAmount, shippingCost and discountAmount are now named parameters
  • trackOutlink positional parameter link is now a named required parameter (also changed the type to String)

v3.0.0

Now the initialize() method takes a LocalStorage? localStorage instead of a SharedPreferences? prefs as its parameter to override the persistent data implementation.

By default it will use an implementation of shared_preferences with the class SharedPrefsStorage, but you can provide your own implementation of LocalStorage to use a different package.

Before
final myPrefs = await SharedPreferences.getInstance();

await MatomoTracker.instance.initialize(
    siteId: siteId,
    url: 'https://example.com/matomo.php',
    prefs: myPrefs,
);
After
class MyLocalStorage implements LocalStorage {
    MyLocalStorage();

    // ...
}

final myStorage = MyLocalStorage();

await MatomoTracker.instance.initialize(
    siteId: siteId,
    url: 'https://example.com/matomo.php',
    localStorage: myStorage,
);

Note that if you weren't using a custom instance of SharedPreferences before, you don't need to change anything. The default behavior still works.

await MatomoTracker.instance.initialize(
    siteId: siteId,
    url: 'https://example.com/matomo.php',
);

Contributors

TesteurManiak
Guillaume Roux
EPNW-Eric
Null
Pierre-Monier
Pierre Monier
poitch
Jêrôme Poichet
M123-dev
Marvin Möltgen
krille-chan
Krille-chan
scolnet
Scolnet
MeixDev
Meï
KawachenCofinpro
Null
stefan01
Null
petcupaula
Paula Petcu
stefangaller
Stefan Galler
luckyrat
Chris Tomlinson
CleverUnderDog
Null
JohannSchramm
Johann Schramm
lsaudon
Lsaudon
kuhnroyal
Peter Leibiger
streinhard
Stefan Reinhard
zvikarp
Zvi Karp
tfreebern2
Timothy Freebern II
Hyla96
Gabriel Costache
hpoul
Herbert Poul
jainhitesh9998
Hitesh C
JulianBissekkou
Julian Bissekkou
krozett
Keith Rozett
lukaslihotzki
Lukas Lihotzki
skiluk
Sean Kiluk
svprdga
David Serrano Canales

카테고리

의존성

의존성 목록 7 개

소스 저장소

이 패키지를 사용하는 프로젝트