Skip to content

Conversion Tracking - #25

Merged
gcg merged 3 commits into
mainfrom
feature/conversion-tracking
Sep 18, 2026
Merged

gcg merged 3 commits into
mainfrom
feature/conversion-tracking

Conversation

@gcg

@gcg gcg commented Sep 18, 2026

Copy link
Copy Markdown
Member

feat: add recordPurchase conversion tracking to iOS and Android SDKs
Adds a dedicated recordPurchase API on both native SDKs mirroring the
/sdk/mobile/v1/purchase backend contract, replacing the untyped
track(event: "TrackConversion", ...) example that never actually hit
the network. Rejects invalid input (blank orderId, non-positive value,
malformed url) client-side without a network call, and documents the
new API in the root README.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

Adds a dedicated recordPurchase API on both native SDKs mirroring the
/sdk/mobile/v1/purchase backend contract, replacing the untyped
track(event: "TrackConversion", ...) example that never actually hit
the network. Rejects invalid input (blank orderId, non-positive value,
malformed url) client-side without a network call, and documents the
new API in the root README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@gcg gcg self-assigned this Sep 18, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a dedicated recordPurchase API to both the Android and iOS SDKs for tracking completed purchases and conversion attribution, along with corresponding models, validation logic, documentation, and unit tests. The review feedback is highly constructive and suggests strengthening input validation by ensuring the purchase value is finite (isFinite) on both platforms to prevent serialization failures. Additionally, it recommends casting Unix timestamps to Int64 instead of Int in Swift to avoid potential overflow issues on 32-bit architectures.

Comment thread android/poltio-sdk/src/main/java/com/poltio/sdk/PoltioSDK.kt Outdated
Comment thread ios/Sources/PoltioSDK/PoltioSDK.swift Outdated
Comment thread ios/Sources/PoltioSDK/PoltioAPIClient.swift
Addresses Gemini Code Assist review feedback on PR #25: value <= 0
doesn't reject NaN/Infinity (comparisons with NaN are always false,
so Kotlin's <= 0 check let NaN through as "valid"), and Int can
overflow event_time on 32-bit architectures.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@gcg

gcg commented Sep 18, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new recordPurchase API for both Android and iOS SDKs to support conversion attribution. It includes the necessary data models, network client updates, and comprehensive validation for inputs like orderId, value, and url. The reviewer suggests enhancing the validation logic by filtering the items list to ensure data integrity and improving URL construction robustness by trimming trailing slashes from the base URL.

Comment thread android/poltio-sdk/src/main/java/com/poltio/sdk/PoltioSDK.kt
Comment thread ios/Sources/PoltioSDK/PoltioSDK.swift
Comment thread android/poltio-sdk/src/main/java/com/poltio/sdk/PoltioAPIClient.kt
…id baseURL

Addresses second round of Gemini Code Assist feedback on PR #25: a
single malformed item (blank id, non-finite value, non-positive
quantity) previously aborted the entire purchase since it corrupted
JSON serialization of the whole payload, even though the top-level
value had already passed validation — now invalid items are dropped
with a warning instead. Also trims a trailing slash from Android's
baseURL at construction (mirroring iOS) so a misconfigured baseURL
can't double up in any endpoint path.
@gcg
gcg requested review from a team, cantugdonmez, hionay and onurhanavci September 18, 2026 08:54
@gcg
gcg merged commit d1d9aeb into main Sep 18, 2026
5 checks passed
@gcg
gcg deleted the feature/conversion-tracking branch September 18, 2026 09:51
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.

1 participant