Add new analytics parameters pathSuffix
Some checks failed
openium/resgen.swift/pipeline/head There was a failure building this commit
Some checks failed
openium/resgen.swift/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -11,11 +11,11 @@ import Foundation
|
||||
|
||||
enum MatomoGenerator {
|
||||
|
||||
static var service: String {
|
||||
static func service(pathSuffix: String) -> String {
|
||||
[
|
||||
Self.header,
|
||||
Self.setup,
|
||||
Self.logScreen,
|
||||
Self.logScreen(pathSuffix: pathSuffix),
|
||||
Self.logEvent,
|
||||
Self.enable,
|
||||
Self.footer
|
||||
@@ -67,8 +67,14 @@ enum MatomoGenerator {
|
||||
"""
|
||||
}
|
||||
|
||||
private static var logScreen: String {
|
||||
"""
|
||||
private static func logScreen(pathSuffix: String) -> String {
|
||||
let pathSuffixCode: String = if pathSuffix.isEmpty == false {
|
||||
" + \"/\(pathSuffix)\""
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
||||
return """
|
||||
func logScreen(
|
||||
name: String,
|
||||
path: String,
|
||||
@@ -76,7 +82,7 @@ enum MatomoGenerator {
|
||||
) {
|
||||
guard let trackerUrl = tracker.contentBase?.absoluteString else { return }
|
||||
|
||||
let urlString = URL(string: "\\(trackerUrl)" + "/" + "\\(path)" + "iOS")
|
||||
let urlString = URL(string: "\\(trackerUrl)" + "/" + "\\(path)"\(pathSuffixCode)
|
||||
tracker.track(
|
||||
view: [name],
|
||||
url: urlString
|
||||
|
||||
Reference in New Issue
Block a user