From 817fbd6a33a50bf14932f9a0355571292da0bdee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20De=CC=81fago?= Date: Mon, 6 Jan 2025 10:37:19 +0100 Subject: [PATCH 1/2] Remove comScore page views --- Sources/SRGAnalytics/SRGAnalyticsTracker.m | 51 ---------------------- 1 file changed, 51 deletions(-) diff --git a/Sources/SRGAnalytics/SRGAnalyticsTracker.m b/Sources/SRGAnalytics/SRGAnalyticsTracker.m index 74b55109..02f7e0ed 100644 --- a/Sources/SRGAnalytics/SRGAnalyticsTracker.m +++ b/Sources/SRGAnalytics/SRGAnalyticsTracker.m @@ -332,57 +332,6 @@ - (void)trackPageViewWithTitle:(NSString *)title } [self trackCommandersActPageViewWithTitle:title type:type levels:levels labels:labels fromPushNotification:fromPushNotification]; - [self trackComScorePageViewWithTitle:title levels:levels labels:labels fromPushNotification:fromPushNotification]; -} - -- (void)trackComScorePageViewWithTitle:(NSString *)title - levels:(NSArray *)levels - labels:(SRGAnalyticsPageViewLabels *)labels - fromPushNotification:(BOOL)fromPushNotification -{ - NSAssert(title.length != 0, @"A title is required"); - - NSMutableDictionary *fullLabels = self.defaultComScoreLabels.mutableCopy; - [fullLabels srg_safelySetString:title forKey:@"srg_title"]; - [fullLabels srg_safelySetString:@(fromPushNotification).stringValue forKey:@"srg_ap_push"]; - - NSString *category = @"app"; - - if (! levels) { - [fullLabels srg_safelySetString:category forKey:@"srg_n1"]; - } - else if (levels.count > 0) { - __block NSMutableString *levelsComScoreFormattedString = [NSMutableString new]; - [levels enumerateObjectsUsingBlock:^(NSString * _Nonnull object, NSUInteger idx, BOOL * _Nonnull stop) { - NSString *levelKey = [NSString stringWithFormat:@"srg_n%@", @(idx + 1)]; - NSString *levelValue = [object description]; - - if (idx < 10) { - [fullLabels srg_safelySetString:levelValue forKey:levelKey]; - } - - if (levelsComScoreFormattedString.length > 0) { - [levelsComScoreFormattedString appendString:@"."]; - } - [levelsComScoreFormattedString appendString:levelValue.srg_comScoreFormattedString]; - }]; - - category = levelsComScoreFormattedString.copy; - } - - [fullLabels srg_safelySetString:category forKey:@"ns_category"]; - [fullLabels srg_safelySetString:[self pageIdWithTitle:title levels:levels] forKey:@"name"]; - - NSDictionary *comScoreLabelsDictionary = [labels comScoreLabelsDictionary]; - if (comScoreLabelsDictionary) { - [fullLabels addEntriesFromDictionary:comScoreLabelsDictionary]; - } - - if (self.configuration.unitTesting) { - [fullLabels srg_safelySetString:SRGAnalyticsUnitTestingIdentifier() forKey:@"srg_test_id"]; - } - - [SCORAnalytics notifyViewEventWithLabels:fullLabels.copy]; } - (void)trackCommandersActPageViewWithTitle:(NSString *)title From 4693cd724444f5c659f587f06591eba89335d718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20De=CC=81fago?= Date: Mon, 20 Jan 2025 08:12:10 +0100 Subject: [PATCH 2/2] Update documentation --- Sources/SRGAnalytics/include/SRGAnalyticsTracker.h | 4 ++-- docs/GETTING_STARTED.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/SRGAnalytics/include/SRGAnalyticsTracker.h b/Sources/SRGAnalytics/include/SRGAnalyticsTracker.h index ea6b0748..20e77582 100644 --- a/Sources/SRGAnalytics/include/SRGAnalyticsTracker.h +++ b/Sources/SRGAnalytics/include/SRGAnalyticsTracker.h @@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN * * The SRG Analytics library supports three kinds of measurements: * - View events: Appearance of views (page views), which makes it possible to track which content is seen by users. - * - Events: Custom events which can be used for measuresement of application functionalities. + * - Events: Custom events which can be used for measurement of application functionalities. * - Stream playback events: Measurements for audio and video consumption. * * For all kinds of measurements, required information must be provided through mandatory parameters, and optional @@ -172,7 +172,7 @@ NS_EXTENSION_UNAVAILABLE("SRG Analytics does not support application extensions" * This is for example the case if your application runs a secondary external window while it might itself be in the * background (e.g. CarPlay scene). * - * Be extremely careful when using the APIs below, as your application might be rejected if illegitmate page views are + * Be extremely careful when using the APIs below, as your application might be rejected if illegitimate page views are * emitted in the background. */ @interface SRGAnalyticsTracker (UncheckedPageViewTracking) diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index 67f7d516..77e2da7b 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -140,7 +140,6 @@ and implement the methods you need to supply measurement information: SRGAnalyticsPageViewLabels *labels = [[SRGAnalyticsPageViewLabels alloc] init]; labels.customInfo = @{ @"MYAPP_CATEGORY" : @"general", @"MYAPP_TIME" : @"1499319314" }; - labels.comScoreCustomInfo = @{ @"myapp_category" : @"gen" }; return labels; } @@ -149,7 +148,7 @@ and implement the methods you need to supply measurement information: When the view is opened for the first time, or if the view is visible on screen when waking up the application, this information will be automatically sent. -Note that the labels might differ depending on the service they are sent to. Be sure to apply the conventions required for measurements of your application. Moreover, custom information requires the corresponding variables to be defined for Commanders Act first (unlike comScore information which can be freely defined). +Note that the labels might differ depending on the service they are sent to. Be sure to apply the conventions required for measurements of your application. Moreover, custom information requires the corresponding variables to be defined server-side for Commanders Act first. ## Measuring page views (SwiftUI) @@ -160,7 +159,8 @@ struct ContentView: View { var body: some View { VStack { // ... - }.tracked(withTitle: "home", type: "landing_page") + } + .tracked(withTitle: "home", type: "landing_page") } } ```