-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
258 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// Copyright (c) SRG SSR. All rights reserved. | ||
// | ||
// License information is available from the LICENSE file. | ||
// | ||
|
||
import Foundation | ||
|
||
/// A protocol for analytics data sources. | ||
public protocol AnalyticsDataSource: AnyObject { | ||
/// comScore global labels. | ||
var comScoreGlobals: ComScoreGlobals { get } | ||
/// Commanders Act global labels. | ||
var commandersActGlobals: CommandersActGlobals { get } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// Copyright (c) SRG SSR. All rights reserved. | ||
// | ||
// License information is available from the LICENSE file. | ||
// | ||
|
||
import Foundation | ||
|
||
/// An enum representing the user consent options for comScore. | ||
public enum ComScoreConsent: String { | ||
/// The user's consent status is unknown. | ||
case unknown = "" | ||
|
||
/// The user has accepted comScore analytics. | ||
case accepted = "1" | ||
|
||
/// The user has declined comScore analytics. | ||
case declined = "0" | ||
} | ||
|
||
/// A struct representing global labels to send to comScore. | ||
public struct ComScoreGlobals { | ||
let labels: [String: String] | ||
|
||
/// Creates comScore global labels. | ||
/// | ||
/// - Parameters: | ||
/// - consent: The user's consent status. | ||
/// - labels: Additional information associated with the global labels. | ||
public init(consent: ComScoreConsent, labels: [String: String]) { | ||
self.labels = labels.merging(["cs_ucfr": consent.rawValue]) { _, new in new } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Sources/Analytics/CommandersAct/CommandersActGlobals.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// Copyright (c) SRG SSR. All rights reserved. | ||
// | ||
// License information is available from the LICENSE file. | ||
// | ||
|
||
import Foundation | ||
|
||
/// A struct representing global labels to send to Commanders Act. | ||
public struct CommandersActGlobals { | ||
let labels: [String: String] | ||
|
||
/// Creates Commanders Act global labels. | ||
/// | ||
/// - Parameters: | ||
/// - consentServices: The list of service allowed. | ||
/// - labels: Additional information associated with the global labels. | ||
public init(consentServices: [String], labels: [String: String]) { | ||
self.labels = labels.merging([ | ||
"consent_services": consentServices.joined(separator: ",") | ||
]) { _, new in new } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.