搜尋套件、儲存庫與 APP 分類

套件詳情v2.0.3

analytics

用於處理分析服務的介面。該程式庫旨在統一處理各種分析服務。

AndroidiOSmacOSWindowsLinux
近 30 天下載
750
喜歡數
43
Pub 分數
150

安裝套件

flutter pub add analytics

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

分析套件為在Flutter平台整合與管理多個分析服務提供了一個統一介面。設計用於簡化使用者行為與應用效能的追蹤,抽象了各種分析供應商之間的差異,讓開發者能輕鬆切換或同時使用多個服務。此套件支援Android、iOS、macOS、Windows及Linux,非常適合需要一致資料收集的跨平台應用。它透過單一API實現事件記錄、使用者屬性追蹤與會話管理。

適用情境

  • 跨平台分析整合
  • 跨多個提供者的一致事件追蹤
  • 用戶行為監控
  • 應用性能測量
  • A/B測試數據收集

主要特色

  • 平台無關的分析介面
  • 對多種分析後端的支援
  • 跨平台的一致性 API
  • 輕鬆切換服務
  • 事件和用戶屬性追蹤

適合對象

  • 開發跨平台應用的開發者
  • 使用多個分析工具的團隊
  • 需要靈活分析配置的項目
  • 需要詳細用戶洞察的應用
  • 新創公司盡早標準化分析

使用建議

  • 需要設定個別分析提供者
  • 可能會因新增相依性而增加應用程式大小
  • 取決於提供者特定的實作細節
  • 需要謹慎處理隱私和同意
  • 受限於底層提供方支援的功能

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Analytics

Made by Surf 🏄‍♂️🏄‍♂️🏄‍♂️

Build Status Coverage Status Pub Version Pub Likes Pub popularity Flutter Platform

Overview

Interface for working with analytic services. The library is supposed to unify work with various analytic services. The main actors are:

  • AnalyticAction — any action that is valuable for analytics. Usually it is a "button pressed" or "screen opened" type of event but the main criterion is a possibility to be handled by AnalyticStrategy.
  • AnalyticActionPerformer - an interface for analytic action performers. This class is an abstract base class for analytic strategies.
  • AnalyticStrategy — a class that provides a special way to send an analytical action. To create a custom analytic strategy, you should extend this class and implement the performAction method.
  • AnalyticService — a class that provides a way to send analytic action using a set of analytic strategies. To use this class, you should create an instance of it with a set of analytic strategies, and then call the performAction method to send analytic action.

Example

The easiest interaction with the library is as follows:

  1. Determine the actions that ought to be recorded in the analytics service:

    class MyAnalyticAction implements AnalyticAction {
        final String key;
        final String value;
    
        MyAnalyticAction(this.key, this.value);
    }
    
    class ButtonPressedAction extends MyAnalyticAction {
        ButtonPressedAction() : super("button_pressed", null);
    }
    
    class ScreenOpenedAction extends MyAnalyticAction {
        ScreenOpenedAction({String param}) : super("screen_opened", param);
    }
    
  2. Implement analytic strategy:

    class MyAnalyticStrategy
        extends AnalyticStrategy<MyAnalyticAction> {
        final SomeAnalyticsApi _analyticsApi;
    
        SomeAnalyticsApi(this._analyticsApi);
    
        @override
        void performAction(MyAnalyticAction action) {
            _analyticsApi.send(action.key, action.value);
        }
    }
    
  3. Create an AnalyticService with your strategy:

    final analyticService = AnalyticService.withStrategies({
        MyAnalyticStrategy(analytics),
    });
    

Usage:

    analyticService.performAction(ButtonPressedAction());

Installation

Add analytics to your pubspec.yaml file:

dependencies:
  analytics: $currentVersion$

At this moment, the current version of analytics is analytics version.

Migrating from 1.x.x to 2.x.x

1.x.x

    final analyticService = DefaultAnalyticService();
    analyticService.addActionPerformer(
        MyAnalyticActionPerformer(SomeAnalyticService()),
    );

Starting from version 2.0.0, sending an event to a specific analytics service is implemented using strategies. The AnalyticService class stores these strategies. Implement analytics strategies using the AnalyticStrategy egy class.

    final analyticService = AnalyticService.withStrategies({
        MyAnalyticStrategy(analytics),
    });

Changelog

All notable changes to this project will be documented in this file.

Issues

To report your issues, submit directly in the Issues section.

Contribute

If you would like to contribute to the package (e.g. by improving the documentation, fixing a bug or adding a cool new feature), please read our contribution guide first and send us your pull request.

Your PRs are always welcome.

How to reach us

Please feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.

Telegram

License

Apache License, Version 2.0

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案