Skip to content

davidli86/DynamicStatistics

Repository files navigation

DynamicStatistics

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

DynamicStatistics is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DynamicStatistics_OC'

What is it?

It is a simple library helps to collect user action dynamically.

How to use?

Setup config file with local plist file or from network.

With local plist file:

[[DynamicStatistics sharedInstance] setupWithPlist:@"DynamicStatistics" andEventLogBlock:^(DSViewEvent *event) {
//todo: log the event with your service or any other analytic platform, like Flurry.
}];

From network(pure text, not a file):

[[DynamicStatistics sharedInstance] setupWithUrlString:@"http://xxx.com/version=1.0" andEventLogBlock:^(DSViewEvent *event) {
//todo: log the event with your service or any other analytic platform, like Flurry.
}];

Plist file format

The plist format should keep the same format with local and network. viewPath is the key to identify the view. It is like a simplified XPath, but with index in the end. Set index to * to represent any position. eventName is a readable name to describe the viewPath. Specially, set viewPath to DSLogAllEvent or DSLogAllPageEvent as a flag, to log all events or page events.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
   "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <array>
        <dict>
            <key>viewPath</key>
            <string>DSLogAllEvent</string>
        </dict>
        <dict>
            <key>viewPath</key>
            <string>DSViewController-UIAlertAction_OK&amp;&amp;0-0</string>
            <key>eventName</key>
            <string>AlertVC-OK</string>
        </dict>
        <dict>
            <key>viewPath</key>
            <string>DSViewController-UIAlertAction_Cancel&amp;&amp;0-0</string>
            <key>eventName</key>
            <string>AlertVC-Cancel</string>
        </dict>
        <dict>
            <key>viewPath</key>
            <string>DSViewController-UIView-UITableView-UITableViewWrapperView-UITableViewCell&amp;&amp;0-0-1-0-*:*</string>
            <key>eventName</key>
            <string>HomePage-TableCell</string>
        </dict>
        <dict>
            <key>viewPath</key>
            <string>DSViewController-UIView-UIButton&amp;&amp;0-0-5</string>
            <key>eventName</key>
            <string>ShowAlertController</string>
        </dict>
        <dict>
            <key>viewPath</key>
            <string>DSViewController&amp;&amp;*</string>
            <key>eventName</key>
            <string>Homepage</string>
        </dict>
    </array>
</plist>

Author

David, 492334421@qq.com

License

DynamicStatistics is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published