At present, data statistics has become a common demand trend of products, especially in the early stage of business model exploration or product maturity, buried point function is an essential function, the following will introduce the simplest App and front-end full buried point scheme. Later, I will introduce how to achieve a business from 0 to 1 from a product perspective. Including all the problems we encountered along the way.

background

At present, statistics have become a common requirement of products, especially in the early stage of business model exploration and the late stage of project maturity, buried point function is an essential function, the following will introduce the simplest full buried point scheme of App!

What are data burying points

Data burying point is a general project using statistical UV, PV, Action, Time and a series of data information, to capture, process and send specific user behavior or events related technology and its implementation process.

Why data burying point

Product or operation analysts, based on the needs of buried data analysis, arrange buried points for each event of user behavior, and report buried data results through SDK for analysis, and further optimize products or guide operations.

What data burying points include

Here is an article I wrote earlier about the App’s high-quality and accurate user behavior statistics and log salvage scheme

Address: http://blog.csdn.net/sk719887916/article/details/50931485

App to build custom statistics SDK, it’s time to say goodbye to Umeng.

  1. What are the specific data to be collected?

  2. What about the reporting strategy scenario?

Readers can proceed directly to the above article.

Buried data acquisition mode

Automatic submerged point

App invokes Sdk related API through proxy to report data burying point.

Non-trace buried point

There is no need to provide proxy classes for the project. The SDK directly provides relevant interfaces, or uses compilation tools and pre-compilation to replace the code. The SDK is directly responsible for collecting and reporting the project.

Visual burial point

Visual burying point refers to the solution that the front end or App end accurately and automatically burying point and reporting based on DOM elements and controls.

Comparative analysis:

Automatic burying point:

Disadvantages:

1 Developers need to provide unique ids for services to distinguish each service due to heavy workload. Service developers need to invoke SDK-related apis at least several times, regardless of whether SDK agents are provided.

2. As the cost of communication between business personnel and products increases, it is necessary to make relevant business identification for specific businesses to facilitate product analysis and statistics

Advantages:

The workload of product operation is small, and the related business scenarios can be analyzed and restored by comparing the business mapping table. The data is relatively fine, and there is no need for a lot of processing and processing.

Non-trace buried point

Disadvantages:

1 SDK developers need to provide a set of finished products of traceless burying point technology, including the correct acquisition of PV, UV, Action,Time and other statistical indicators. Large technical input in the early stage.

2 A large amount of data needs to be processed by the backend, and the product restores the salesman scenario by itself. Whether using intelligent system platform, or through the native database query data, is a lot of analysis energy.

Advantages:

1 The workload of developers is small, so there is no need to make a unique distinction between business ids. The IDS are automatically generated by SDK, and the ID rules are agreed between SDK and the product. Reduce communication costs and usage steps for business people.

2 Comprehensive data volume, wide coverage, products can be analyzed on demand. Make sure you leave nothing out.

3 Support dynamic page and local dynamic effect statistics.

Visual burial point

Advantages:

1 Relative to data volume

Compared with no burial site in terms of facies of lower, but the visual elements of the recognition and the traversal technique is to achieve by the client or the front, a unique id generated no client to custom rules, the rules generated by related products under the condition of the automation tool configuration table, issued to the client, and then by the client according to pit you class to the relevant interface to achieve it.

2 The amount of data is relatively accurate

Disadvantages:

The platform construction of visual tools and element recognition of static pages need additional development.

2 Dynamic effects may be missed.

Implementation scheme:

Burying point requirements can be referred to an article I wrote before:

App high-quality and accurate user behavior statistics and log salvage scheme

App to create a custom statistics SDK

Automatic submerged point is actually very simple, but provides a base class, by business class inherits that base class inside the base to do relevant statistics API call my Github:https://github.com/Tamicer/SkyMonitoring for reference

Visual core implementation:

  • 1. SDK technology implementation:

  • 2 landing data background and front-end visualization platform

  • 3 Visual element page to generate OA tool

  • Front-end, mobile, and back-end unified path through and unique user identification technology.

Using Android as an example, iOS and the front end are roughly the same:

Activities and viewControler that automatically traverse elements and capture clickable controls, count pv on and off during the corresponding lifecycle, and call my open source SkyMonitoring API.

Duplicate the dispatchTouchEvent(MotionEvent EV) event function to determine the relevant location of the view clicked and generate a unique ID. Enterprise-class apps send the corresponding ID from the server and call the embedded SDK Api on the corresponding page to realize the event behavior callable:

TcStatInterface.initEvent(path.viewTree); .Copy the code

This Path is the view’s Path. The depth path of the page, including opening and closing SDKS, is automatically obtained in SkyMonitoring.

The demo id generation rules are as follows: Package name + Activity+ Viewgroup+ Layout+ View + View Index + ViewID.

Business directly to inherit from TamicActivity, can be to achieve all of the visual View buried functions.

The code is as follows:

public abstract class TamicActivity extends AppCompatActivity { private int statusBarHeight; View rootView; String rootViewTree; String bigDataPrefix; String bigDataIngorePrefix; String bigDataEventPrefix; private String TAG = "Tamic"; @Override public void onAttachedToWindow() { super.onAttachedToWindow(); RootView = getWindow().getdecorView (); // Control root path in view tree rootViewTree = getPackageName() + "." + getClass().getSimplename (); // Prefix name bigData bigDataPrefix = "Tamic_test"; // Prefix name bigData_ bigDataIngorePrefix = bigDataPrefix + ""; // Prefix name bigDatA_ignore bigDataEventPrefix = bigDataIngorePrefix +"Igmore"; } @Override protected void onResume() { super.onResume(); TcStatInterface.recordPageStart(TamicActivity.this); } @Override protected void onPause() { super.onPause(); TcStatInterface.recordPageEnd(); } @Override protected void onDestroy() { super.onDestroy(); / / APP exit TcStatInterface. RecordAppEnd (); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { if(ev.getAction() == MotionEvent.ACTION_DOWN){ ViewPath path = findClickView(ev); if(path ! = null) { Log.e(TAG, "path -->" + path.viewTree); / / call the SDK event statistics TcStatInterface. InitEvent (path. ViewTree); } } return super.dispatchTouchEvent(ev); } private ViewPath findClickView(MotionEvent ev) { Log.e(TAG, "bigdata-->findClickView"); ViewPath clickView = new ViewPath(rootView, rootViewTree); return searchClickView(clickView, ev, 0); } private ViewPath searchClickView(ViewPath myView, MotionEvent event, int index) { ViewPath clickView = null; View view = myView.view; if (isInView(view, event)) { myView.level++; if (myView.level == 2 && !" LinearLayout".equals(view.getClass().getSimpleName())) { myView.filterLevelCount++; } if (myView.level > myView.filterLevelCount) { myView.viewTree = myView.viewTree + "." + view.getClass().getSimpleName() + "[" + index + "]"; } Log.i(TAG, "bigdata-->tag = " + view.getTag()); if (view.getTag() ! String tag = view.getTag().toString(); if (tag.startsWith(bigDataIngorePrefix)) { return null; } else if (tag.startsWith(bigDataPrefix)) { if (tag.startsWith(bigDataEventPrefix)) { myView.specifyTag = tag.replace(bigDataEventPrefix, ""); } return myView; } } if (view instanceof ViewGroup) { if (view instanceof AbsListView) { Log.i(TAG, "bigdata-->AbsListView "); return null; } ViewGroup group = (ViewGroup) view; int childCount = group.getChildCount(); if (childCount == 0) { return myView; } for (int i = childCount - 1; i >= 0; i--) { myView.view = group.getChildAt(i); clickView = searchClickView(myView, event, i); if (clickView ! = null) { return clickView; } } } else { clickView = myView; } } return clickView; } private boolean isInView(View view, MotionEvent event) { if (view == null || view.getVisibility() ! = View.VISIBLE) { return false; } int clickX = (int) event.getRawX(); int clickY = (int) event.getRawY(); int[] location = new int[2]; view.getLocationOnScreen(location); int x = location[0]; int y = location[1]; int width = view.getWidth(); int height = view.getHeight(); return clickX > x && clickX < (x + width) && clickY > y && clickY < (y + height); }}

Copy the code

APP project integrated use, initialize url and related statistics configuration dictionary, the dictionary can be delivered from the server, this time I just do the practice by simply loading local files.

public class StatAppliation extends Application { @Override public void onCreate() { super.onCreate(); // you app id int appId = 21212; // assets String fileName = "my_statconfig.json"; String url = "https://github.com/Tamicer/TamicAppMonitoring"; // init statisSdk TcStatInterface.initialize(this, appId, "you app chanel", fileName); TcStatInterface.setUrl(url); TcStatInterface.setUploadPolicy(TcStatInterface.UploadPolicy.UPLOAD_POLICY_DEVELOPMENT, TcStatInterface.UPLOAD_TIME_ONE); }}

Copy the code

Visualization can also be implemented using Aop techniques for staking, but the implementation is too intrusive to cover here.

It is worth mentioning that Aop peg supports fragmentation better. The introduction of this piece can be seen in my previous public account push an article

: AspectJ practical implementation of AOP programming data trace – free burying point

Read more articles at the end.

For official reference:

https://www.baidu.com/link?url=FniQOFyj1pd6O5Fz6viRMN3ZgexIKAk7SQ08EgpBU9cHHMszPlm2jRXJ21mkomtY&wd=&eqid=ffc87acf0005fd1 8000000045a5d98dd

Project Address:

Github:https://github.com/Tamicer/TamicAppMonitoring

Source: Developer Tech Front

This paper address: http://blog.csdn.net/sk719887916/article/details/79074556

Author: Tamic

You are invited to join the free circle

The Android statistics thing

App to build custom statistics SDK, it’s time to say goodbye to Umeng

Teach you to use Android built-in statistics service a trick against the enemy

AspectJ practical implementation of AOP programming data trace – free burying point