Skip to content

Commit

Permalink
Use page name instead of content title for Commanders Act (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
waliid authored Sep 5, 2023
1 parent 07bec87 commit 023db67
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Sources/Analytics/CommandersAct/CommandersActLabels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public struct CommandersActLabels: Decodable {
/// The value of `page_type`.
public let page_type: String?

/// The value of `content_title`.
public let content_title: String?
/// The value of `page_name`.
public let page_name: String?

// MARK: Streaming labels

Expand Down Expand Up @@ -140,7 +140,7 @@ private extension CommandersActLabels {
case navigation_level_8
case navigation_level_9
case page_type
case content_title
case page_name
case media_player_display
case media_player_version
case media_subtitle_selection
Expand Down
2 changes: 1 addition & 1 deletion Sources/Analytics/CommandersAct/CommandersActService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class CommandersActService {
pageView.labels.forEach { key, value in
event.addAdditionalProperty(key, withStringValue: value)
}
event.addNonBlankAdditionalProperty("content_title", withStringValue: pageView.name)
event.pageName = pageView.name
event.addNonBlankAdditionalProperty("navigation_property_type", withStringValue: "app")
event.addNonBlankAdditionalProperty("navigation_bu_distributer", withStringValue: vendor?.rawValue)
pageView.levels.enumerated().forEach { index, level in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class CommandersActPageViewTests: CommandersActTestCase {
expectAtLeastHits(
.page_view { labels in
expect(labels.page_type).to(equal("type"))
expect(labels.content_title).to(equal("name"))
expect(labels.page_name).to(equal("name"))
expect(labels.navigation_level_0).to(beNil())
expect(labels.navigation_level_1).to(equal("level_1"))
expect(labels.navigation_level_2).to(equal("level_2"))
Expand Down Expand Up @@ -73,7 +73,7 @@ final class CommandersActPageViewTests: CommandersActTestCase {
expectAtLeastHits(
.page_view { labels in
expect(labels.page_type).to(equal("type"))
expect(labels.content_title).to(equal("name"))
expect(labels.page_name).to(equal("name"))
expect(labels.navigation_level_1).to(beNil())
expect(labels.navigation_level_2).to(beNil())
expect(labels.navigation_level_3).to(beNil())
Expand Down Expand Up @@ -125,15 +125,15 @@ final class CommandersActPageViewTests: CommandersActTestCase {
func testLabelsForbiddenOverrides() {
expectAtLeastHits(
.page_view { labels in
expect(labels.content_title).to(equal("name"))
expect(labels.page_name).to(equal("name"))
}
) {
Analytics.shared.trackPageView(
comScore: .init(name: "name"),
commandersAct: .init(
name: "name",
type: "type",
labels: ["content_title": "overridden_title"]
labels: ["page_name": "overridden_title"]
)
)
}
Expand Down

0 comments on commit 023db67

Please sign in to comment.