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 autocapture for element clicks #199

Merged
merged 26 commits into from
Jun 12, 2024

Conversation

PouriaAmini
Copy link
Contributor

@PouriaAmini PouriaAmini commented Jun 6, 2024

Summary

This PR removes support for Android SDKs 18 and below.

This PR adds the Autocapture feature to enable automatically tracking clicks on clickable element for the legacy Android View system and Jetpack Compose. This functionality is available to both new and existing users but is disabled by default. To enable it, set userInteractions in DefaultTrackingOptions to true:

@OptIn(ExperimentalAmplitudeFeature::class)
Amplitude(
    Configuration(
        apiKey = AMPLITUDE_API_KEY,
        context = applicationContext,
        defaultTracking = DefaultTrackingOptions(
            userInteractions = true
        )
    )
)

Note: To use this feature, the @OptIn(ExperimentalAmplitudeFeature::class) is required to be added to the scope of the instance initialization, Activity class definition, or the entire file or module.

New automatically captured event

[Amplitude] Element Clicked: Emitted when a user clicks on a clickable element in the legacy Android View system or a tagged clickable @Composable functions in Compose.

Note: To capture the event in Compose, the clickable @Composable functions must include a Modifier.testTag, otherwise the event will not be captured. Clickable @Composable functions have an OnClick lambda or a Modifier.clickable modifier (for Jetpack Compose > 1.5).

New automatically captured properties

[Amplitude] Element Class: (Android Views only) The canonical name of the underlying class of the clickable element, or the simple name as given in the source code if the canonical name is unavailable.

[Amplitude] Element Resource: (Android Views only) The entry name for the resource identifier of the clicked element.

[Amplitude] Element Tag: (Compose only) The Modifier.testTag specified for the clicked @composable function.

[Amplitude] Element Source: (Android Views and Compose) The type of the origin of the clicked element, either "Android Views" for legacy Android Views or "Jetpack Compose" for Compose.

Checklist

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

@PouriaAmini PouriaAmini requested a review from a team June 6, 2024 22:27
@PouriaAmini PouriaAmini changed the title feat: add autocapture for element clicks feat: add autocapture for element taps Jun 7, 2024
@PouriaAmini PouriaAmini changed the title feat: add autocapture for element taps feat: add autocapture for element clicks Jun 9, 2024
@PouriaAmini PouriaAmini requested review from justin-fiedler, liuyang1520 and a team June 10, 2024 20:34
@PouriaAmini PouriaAmini requested review from justin-fiedler and a team June 10, 2024 23:01
Copy link
Contributor

@justin-fiedler justin-fiedler left a comment

Choose a reason for hiding this comment

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

Hi @PouriaAmini the PR looks great.

I think we should do some testing in the wild with a small group of customers before enabling by default in production. Can you please make this feature (temporary) opt-in only?

Copy link
Contributor

@justin-fiedler justin-fiedler left a comment

Choose a reason for hiding this comment

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

Thanks @PouriaAmini. LGTM. I noticed the build/tests are falling though.

Copy link
Contributor

@Mercy811 Mercy811 left a comment

Choose a reason for hiding this comment

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

Thanks Pouria for adding element clicks autocaputre and using @ExperimentalAmplitudeFeature.

@PouriaAmini PouriaAmini merged commit 7f0a500 into amplitude:main Jun 12, 2024
4 checks passed
github-actions bot pushed a commit that referenced this pull request Aug 8, 2024
# [1.17.0](v1.16.8...v1.17.0) (2024-08-08)

### Bug Fixes

* extract ComposeUtils to share with plugins ([#202](#202)) ([c239bba](c239bba))
* fix release pipeline ([#211](#211)) ([816599f](816599f))
* revert autocapture scroll and swipe ([#206](#206)) ([4b834bd](4b834bd))

### Features

* add autocapture for element clicks ([#199](#199)) ([7f0a500](7f0a500))
* add autocapture in configs ([#207](#207)) ([dcb9393](dcb9393))
* add screen name to elementInteractions properties for autocapture ([#209](#209)) ([8044122](8044122))
* add scroll and swipe autocapture ([#201](#201)) ([1a5a392](1a5a392))
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.

3 participants