Giter Club home page Giter Club logo

aptabase_flutter's Introduction

Aptabase

aptabase_flutter

pub package pub points

Instrument your app with Aptabase, an Open Source, Privacy-First, and Simple Analytics for Mobile, Desktop, and Web Apps.

Platform Support

Android iOS MacOS Web Linux Windows
✔️ ✔️ ✔️ ✔️ ✔️ ✔️

Install

You can install the SDK by running the following command:

pub add aptabase_flutter

Usage

First, you need to get your App Key from Aptabase, you can find it in the Instructions menu on the left side menu.

On your main.dart, import package:aptabase_flutter/aptabase_flutter.dart and initialized the SDK.

void main() async {
+ WidgetsFlutterBinding.ensureInitialized();
+ await Aptabase.init("<YOUR_APP_KEY>"); // 👈 this is where you enter your App Key

  runApp(const MyApp());
}

Note: You need to change your main function to be async and call WidgetsFlutterBinding.ensureInitialized(); before initializing the SDK.

Afterward, you can start tracking events with Aptabase.instance anywhere in your Dart. Here's an example:

import 'package:aptabase_flutter/aptabase_flutter.dart';

class _CounterState extends State<Counter> {
  int _counter = 0;

  // Tracking how many times the user has clicked the button, alongside the current counter value
  void _incrementCounter() {
    Aptabase.instance.trackEvent("increment", { "counter": _counter });
    
    setState(() {
      _counter++;
    });
  }
}

A few important notes:

  1. The SDK will automatically enhance the event with some useful information, like the OS, the app version, and other things.
  2. You're in control of what gets sent to Aptabase. This SDK does not automatically track any events, you need to call trackEvent manually.
    • Because of this, it's generally recommended to at least track an event at startup
  3. You do not need to await for the trackEvent function, it'll run in the background.
  4. Only strings and numbers values are allowed on custom properties

Preparing for Submission to Apple App Store

When submitting your app to the Apple App Store, you'll need to fill out the App Privacy form. You can find all the answers on our How to fill out the Apple App Privacy when using Aptabase guide.

aptabase_flutter's People

Contributors

goenning avatar adrianflutur avatar

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.