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

feat: add default events #455

Merged
merged 8 commits into from
Jul 5, 2023
Merged

feat: add default events #455

merged 8 commits into from
Jul 5, 2023

Conversation

liuyang1520
Copy link
Collaborator

@liuyang1520 liuyang1520 commented Jun 29, 2023

Summary

This PR adds the default events:

  • sessions, unchanged
  • app lifecycles, automatic
  • screen views, automatic
  • deep links, manual, require manually call

For more details, refer to doc.

Updates on the public interface:

Example:

Amplitude.instance().defaultTracking = AMPDefaultTrackingOptions.initWithAllEnabled();
Amplitude.instance().initializeApiKey("xxx", userId: "ios-objc-sample-user")
Amplitude.instance().continueUserActivity(activity: userActivity)
Amplitude *client = [Amplitude instanceWithName:@"xxx"];
client.defaultTracking.deepLinks = YES;
[client initializeApiKey:@"default_tracking"];
[client continueUserActivity:userActivity];

For more options setting the defaultTracking, check: https://github.com/amplitude/Amplitude-iOS/pull/455/files#diff-b12cbff1563d01315b12fe56142072bf3dd6e0f3964d10a48c815ae50e46e1bc.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

@kevinpagtakhan
Copy link

@liuyang1520 can you also share the interface updates here? thank you!

@liuyang1520 liuyang1520 requested a review from a team June 29, 2023 19:41
@liuyang1520
Copy link
Collaborator Author

@liuyang1520 can you also share the interface updates here? thank you!

Good call, updated in desc, thanks for reviewing!

Sources/Amplitude/Amplitude.m Outdated Show resolved Hide resolved
Sources/Amplitude/UIViewController+AMPScreen.m Outdated Show resolved Hide resolved
Tests/DefaultTrackingOptionsTests.m Show resolved Hide resolved
}];

// persist the build/version
[_dbHelper insertOrReplaceKeyValue:APP_BUILD value:currentBuild];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to update the Build and version if there is no build and version changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call, we can skip this when there is no change, will update!

Tests/AmplitudeTests.m Show resolved Hide resolved
if ([activity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
NSString *urlString = activity.webpageURL.absoluteString;
NSString *referrerString = nil;
if (@available(iOS 11, tvOS 11.0, macOS 10.13, watchOS 4.0, *)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question for other versions, we will leave referrerString to nil?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, for other version, I didn't find a way to get the referrerString, so leave it as nil here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we remove the event properties in this case in stead of leave it as nil?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question, when I tested it, I think when sending the event, the nil event property is filtered out already, see this example event. I am not sure which part of our code did it actually (suspecting this code). Also, I think it is not an issue as the TS SDK applies similar strategy, see code.

@liuyang1520 liuyang1520 merged commit 9bf9664 into main Jul 5, 2023
@liuyang1520 liuyang1520 deleted the add-default-events branch July 5, 2023 20:09
github-actions bot pushed a commit that referenced this pull request Jul 5, 2023
# [8.17.0](v8.16.4...v8.17.0) (2023-07-05)

### Features

* add default events ([#455](#455)) ([9bf9664](9bf9664))
@github-actions
Copy link

github-actions bot commented Jul 5, 2023

🎉 This PR is included in version 8.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants