forked from organicmaps/organicmaps
[ios][statistics] Url params from deep links are sent into statistics.
This commit is contained in:
parent
aab28bc72e
commit
a6ce311126
1 changed files with 21 additions and 4 deletions
|
@ -7,13 +7,30 @@ protocol IDeepLinkHandlerStrategy {
|
|||
}
|
||||
|
||||
extension IDeepLinkHandlerStrategy {
|
||||
fileprivate func makeParams(type: String) -> [String: String] {
|
||||
let params = [kStatType : type, kStatProvider: deeplinkURL.provider.statName]
|
||||
guard let components = URLComponents(string: deeplinkURL.url.absoluteString) else {
|
||||
return params
|
||||
}
|
||||
|
||||
var result = [String: String]()
|
||||
components.queryItems?
|
||||
.filter({ $0.name.starts(with: "utm_") || $0.name == "booking_aid" })
|
||||
.forEach({ result[$0.name] = $0.value ?? "" })
|
||||
|
||||
// Internal params are more perffered than url params.
|
||||
for param in params {
|
||||
result.updateValue(param.value, forKey: param.key)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func sendStatisticsOnSuccess(type:String) {
|
||||
Statistics.logEvent(kStatDeeplinkCall, withParameters: [kStatType : type,
|
||||
kStatProvider: deeplinkURL.provider.statName])
|
||||
Statistics.logEvent(kStatDeeplinkCall, withParameters: makeParams(type:type))
|
||||
}
|
||||
|
||||
func sendStatisticsOnFail(type:String) {
|
||||
Statistics.logEvent(kStatDeeplinkCallMissed, withParameters: [kStatType : type,
|
||||
kStatProvider: deeplinkURL.provider.statName])
|
||||
Statistics.logEvent(kStatDeeplinkCallMissed, withParameters: makeParams(type:type))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue