GithubHelp home page GithubHelp logo

morristech / flutter-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thinkingdataanalytics/flutter-sdk

0.0 1.0 0.0 87 KB

Thinking Analytics API for Flutter

License: Apache License 2.0

Java 27.25% Ruby 7.03% Objective-C 18.29% Dart 47.43%

flutter-sdk's Introduction

thinking_analytics

The Official Thinking Analytics Flutter plugin. Used to track events and user properties to Thinking Analytics.

Getting Started

To use this plugin, add thinking_analytics as a dependency in your pubspec.yaml file.

Find the APP ID and Server URL from your Thinking Analytics project settings and TA cluster administrator.

Import package:thinking_analytics/thinking_analytics.dart, and get an instance of ThinkingAnalyticsAPI with your APP ID and Server URL.

In the example below - replace the string APP_ID and SERVER_URL with your own APP ID and Server URL.

In addition, several named parameters are allowed to be passed to the getInstance function for additional options, including:

  • timeZone: default timeZone in native for serializing date to string of required format.
  • mode: [ThinkingAnalyticsMode]. Currently we support 3 modes including normal, debug, and debug only.

Example

import 'package:thinking_analytics/thinking_analytics.dart';


Future<void> example() async {
  final ThinkingAnalyticsAPI ta = await ThinkingAnalyticsAPI.getInstance('APP_ID', 'https://SERVER_URL');

  // optional. set your own distinct ID as an anonymous ID
  ta.identify('you distinct ID');

  // optional. set account ID for the user
  ta.login('the account ID');

  // track an simple event.
  ta.track('example_event');

  // track an event with properties
  ta.track('another_event', properties: <String, dynamic>{
    'PROP_INT': 5678,
    'PROP_DOUBLE': 12.3,
    'PROP_DATE': DateTime.now(),
    'PROP_LIST': ['apple', 'ball', 1234],
    'PROP_BOOL': false,
    'PROP_STRING': 'flutter test',
    });

  // set user properties
  ta.userSet(<String, dynamic>{
    'USER_INT': 1,
    'USER_DOUBLE': 50.12,
    'USER_LIST': ['apple', 'ball', 'cat', 1, DateTime.now().toUtc()],
    'USER_BOOL': true,
    'USER_STRING': 'a user value',
    'USER_DATE': DateTime.now(),
    });

  // optional. post local data to server immediately
  ta.flush();
}

flutter-sdk's People

Contributors

thinkingdataanalytics avatar

Watchers

 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.