Git Product home page Git Product logo

android_viewtracker's Introduction

ViewTracker-Android

Overview

ViewTracker is a data collection library for click and exposure event in user interaction, based on the view event delegate and filter, used to insert statistical code tracelessly and noninvasively.

Features

  • Two platforms support (iOS & Android).
  • Collect click and exposure event tracelessly, noninvasively.
  • Support multiple application scenarios(begin to scroll, end to scroll, auto scroll, window replace inside page, switch page in the TabActivity, enter into the next page, switch back and forth when press Home button).
  • Caller can set the custom data commit method.
  • Custom exposure event, including exposure time threshold and dimension threshold, support server configuration.
  • Little impact on the frame FPS(Frame Per Second) performance.

Get started

Import dependencies

use gradle:

compile('com.alibaba.android:viewtracker:1.0.0@aar')

Init configuration when app start

/**
 * init SDK
 *
 * @param mContext   global application
 * @param mTrackerOpen whether or not track click event
 * @param mTrackerExposureOpen whether or not track exposure event
 * @param printLog       whether or not print the log
 */
TrackerManager.getInstance().init(mContext, mTrackerOpen, mTrackerExposureOpen, printLog);

Dynamic configuration(optional)

JSON server configuration for click event:

{
    "masterSwitch": true, // whether or not track click event
    "sampling":100
}

JSON server configuration for exposure event:

{
    "masterSwitch": true, // whether or not track exposure event
    "timeThreshold": 100, // time threshold
    "dimThreshold": 0.8, // dimension threshold
    "exposureSampling": 100, // sampling frequency
    "batchOpen":false // whether or not commit the exposure event log in batch or one by one
}

The app send a broadcast after pull configuration, internal receiver get it to modify configuration.

JSONObject config = new JSONObject();
// get server configuration for click event
...
JSONObject exposureConfig = new JSONObject();
// get server configuration for exposure event
...
Intent intent = new Intent(ConfigReceiver.ACTION_CONFIG_CHANGED);
intent.putExtra(ConfigReceiver.VIEWTRACKER_CONFIG_KEY, config.toString());
intent.putExtra(ConfigReceiver.VIEWTRACKER_EXPOSURE_CONFIG_KEY, exposureConfig.toString());
context.sendBroadcast(intent);

Set common info inside page, including page name.(optional)

Generally call this in onReumse(),

HashMap<String, String> args = new HashMap<String, String>();
// set page name
args.put(TrackerConstants.PAGE_NAME, pageName);
// set attached common info
...
TrackerManager.getInstance().setCommonInfoMap(args);

Set commit method externally, implement IDataCommit interface.

Class DataCommit implments IDataCommit {}
TrackerManager.getInstance().setCommit(new DataCommit());

Caller set tag for view.

  • Only set view name for collected views.
String viewName = "Button-1";
view.setTag(TrackerConstants.VIEW_TAG_UNIQUE_NAME, viewName);
  • set attached info for collected views.
HashMap<String, String> args = new HashMap<String, String>();
args.put(key, value);
...
view.setTag(TrackerConstants.VIEW_TAG_PARAM, args);
  • Set like this if views inside page need to attach common info.
HashMap<String, String> args = new HashMap<String, String>();
args.put(key, value);
...
getWindow().getDecorView().setTag(TrackerConstants.DECOR_VIEW_TAG_COMMON_INFO, args);

Author

for Q&A

Because the QR code of WeChat Group is valid for a short period , you can join us by search Sunshine07de in WeChat.

for dingTalk

android_viewtracker's People

Contributors

deanhust avatar oldratlee 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.