Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize tracking instrumentation events #179

Merged
merged 7 commits into from
Jun 15, 2017

Conversation

bormind
Copy link
Contributor

@bormind bormind commented Jun 10, 2017

What

  • Renamed tracking events related to the Facebook friends following.
  • Implemented "Loaded More Friends" event tracking.

Why

As a part of an effort of renaming (modernizing) tracking events and adding missing once.

How

  • Deprecated old event names and added new ones.
  • Implemented "Loaded More Friends" event tracking. This event indicates that more then one page of friends was requested. As part of this event two properties are passed: "source" and "page_count"
  • Fixed tests to accommodate deprecated and new event names and properties
  • Added test for "Loaded More Friends" tracking functionality

See 👀

Trello: Modernize following instrumentation

TODO

We probably have to come up with a new name for "Facebook Friend Decline Follow All" event and deprecate the current one

Copy link
Contributor

@justinswart justinswart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bormind had a quick look now and I think it looks good! I've just marked it as requesting changes so that we can approve once we have the event name that you're waiting on for trackDeclineFriendFollowAll.

@@ -1300,31 +1300,57 @@ public final class Koala {
}

public func trackDeclineFriendFollowAll(source: FriendsSource) {
// deprecated
// self.track(event: "Facebook Friend Decline Follow All", properties: deprecatedProps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait until we have the name before merging 👍


XCTAssertEqual([nil, nil, 2],
self.trackingClient.properties.map { $0["page_count"] as! Int? })

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can delete this new line ☝️

Copy link
Contributor

@theginbin theginbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for modernizing Boris!

self.track(event: "Facebook Friend Decline Follow All", properties: ["source": source.trackingString])
}

public func trackFacebookConnect(source: FriendsSource) {
self.track(event: "Facebook Connect", properties: ["source": source.trackingString])
// deprecated
self.track(event: "Facebook Connect", properties: deprecatedProps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we tracked the "source" property in the deprecated event, we still want to keep passing that property. Thus you could do something like this:

let props: [String:Any] = ["source": source.trackingString]
self.track(event: "Facebook Connect", properties: props.withAllValuesFrom(deprecatedProps))
self.track(event: "Connected Facebook", properties: props)

}

public func trackFacebookConnectError(source: FriendsSource) {
self.track(event: "Facebook Connect Error", properties: ["source": source.trackingString])
// deprecated
self.track(event: "Facebook Connect Error", properties: deprecatedProps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above comment. Add the "source" prop here.

}

public func trackFindFriendsView(source: FriendsSource) {
self.track(event: "Find Friends View", properties: ["source": source.trackingString])
// deprecated
self.track(event: "Find Friends View", properties: deprecatedProps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add the "source" prop here.

}

public func trackFriendFollow(source: FriendsSource) {
self.track(event: "Facebook Friend Follow", properties: ["source": source.trackingString])
// deprecated
self.track(event: "Facebook Friend Follow", properties: deprecatedProps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add the "source" prop here.

}

public func trackFriendFollowAll(source: FriendsSource) {
self.track(event: "Facebook Friend Follow All", properties: ["source": source.trackingString])
// deprecated
self.track(event: "Facebook Friend Follow All", properties: deprecatedProps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add the "source" prop here. :)

}

public func trackFriendUnfollow(source: FriendsSource) {
self.track(event: "Facebook Friend Unfollow", properties: ["source": source.trackingString])
// deprecated
self.track(event: "Facebook Friend Unfollow", properties: deprecatedProps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add the "source" prop here. :)

XCTAssertEqual(["Facebook Friend Follow"], self.trackingClient.events)
XCTAssertEqual(["activity"], self.trackingClient.properties(forKey: "source", as: String.self))
XCTAssertEqual(["Facebook Friend Follow", "Followed Facebook Friend"], self.trackingClient.events)
XCTAssertEqual([nil, "activity"], self.trackingClient.properties(forKey: "source", as: String.self))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests should be tracking the "source" property once you add it back in.


source
.takePairWhen(pageCount.skip(first: 1).filter { $0 > 1 })
.observeValues { AppEnvironment.current.koala.loadedMoreFriends(source: $0, pageCount: $1) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@justinswart
Copy link
Contributor

@theginbin ah of course re source attribute, thanks!

@bormind
Copy link
Contributor Author

bormind commented Jun 13, 2017

@theginbin, @justinswart, thank you for the review!!
I added original properties to the deprecated events as @theginbin noted
I added missing modernized version for the "Facebook Friend Decline Follow All"

@theginbin
Copy link
Contributor

merge away @bormind!

@bormind bormind merged commit c677c82 into master Jun 15, 2017
@bormind
Copy link
Contributor Author

bormind commented Jun 15, 2017

Great thanks @theginbin, @justinswart for helping me through!

@bormind bormind deleted the modernize_tracking_instrumentation_events branch June 15, 2017 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants