To run the example project, clone the repo, and run pod install
from the Example directory first.
DynamicStatistics is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'DynamicStatistics_OC'
It is a simple library helps to collect user action dynamically.
Setup config file with local plist file or from network.
[[DynamicStatistics sharedInstance] setupWithPlist:@"DynamicStatistics" andEventLogBlock:^(DSViewEvent *event) {
//todo: log the event with your service or any other analytic platform, like Flurry.
}];
[[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.
}];
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&&0-0</string>
<key>eventName</key>
<string>AlertVC-OK</string>
</dict>
<dict>
<key>viewPath</key>
<string>DSViewController-UIAlertAction_Cancel&&0-0</string>
<key>eventName</key>
<string>AlertVC-Cancel</string>
</dict>
<dict>
<key>viewPath</key>
<string>DSViewController-UIView-UITableView-UITableViewWrapperView-UITableViewCell&&0-0-1-0-*:*</string>
<key>eventName</key>
<string>HomePage-TableCell</string>
</dict>
<dict>
<key>viewPath</key>
<string>DSViewController-UIView-UIButton&&0-0-5</string>
<key>eventName</key>
<string>ShowAlertController</string>
</dict>
<dict>
<key>viewPath</key>
<string>DSViewController&&*</string>
<key>eventName</key>
<string>Homepage</string>
</dict>
</array>
</plist>
David, 492334421@qq.com
DynamicStatistics is available under the MIT license. See the LICENSE file for more info.