Skip to content

feat(tracking): standard events namespace - #16

Merged
Xyzcancer merged 9 commits into
masterfrom
DEV-4409-standart-tracking-metod-unification
Sep 2, 2026
Merged

Xyzcancer merged 9 commits into
masterfrom
DEV-4409-standart-tracking-metod-unification

Conversation

@Xyzcancer

@Xyzcancer Xyzcancer commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Стандартные события трекинга как sdk.tracking.* — тот же неймспейс и те же имена методов, что на нативах. Плагин переведён на опубликованные SDK: Android 2.37.0, iOS 3.31.0.

The tracking namespace lands in the native SDKs first and is not released yet, so
while it is being bridged the plugin resolves both natives from the sibling
checkouts:

- Android via mavenLocal, published from android-sdk with
  `./gradlew :personalization-sdk:publishRees46ReleaseLibraryPublicationToMavenLocal`
  as `com.personalization:personalization-sdk:2.36.0`;
- iOS via a `:path` pod pointing at the ios-sdk checkout.

Both are marked LOCAL WIRING in place and revert to the JitPack coordinate and
the podspec dependency once the native release ships.
Flutter had no standard tracking events at all — only a custom event and a
purchase. They arrive now as `sdk.tracking.*`, the same namespace and the same
method names the native SDKs expose: product and category view, search, cart and
favorites (single and full sync), story view and click, purchase, custom event
and attribution.

Typed models rather than maps: `TrackingItem`, `TrackingSource` and
`TrackingSourceType`, whose `dynamicBlock` carries the wire value `dynamic`,
which cannot name a Dart enum member. Arguments are validated in Dart, before
the channel call.

Each method has its own Pigeon method and both bridges hand straight to the
native `tracking` namespace, so an event fired from Dart is the request the
native SDKs send — no JSON assembled in the plugin.

`PersonalizationSdk.trackEvent` and `trackPurchase` are deprecated in favour of
`tracking.custom` and `tracking.purchase` and keep working.

One divergence to settle before release: the iOS `RecommendedByCase` has no
`stories` case, so a story-attributed source is dropped by the iOS bridge.
`tracking_namespace_test` asserts that every method reaches its own Pigeon
channel with the arguments native expects, that models and the source wire
values survive the crossing, that the shop id is threaded through, and that
arguments are validated before the call.

The demo gets a button per standard event, all calling `sdk.tracking.*`, each
writing its outcome into a result line, and its two existing tracking buttons
move onto the namespace. `tracking_events_test` taps those buttons and reads the
line, so the run exercises every method against the real API.
…e set

The iOS namespace renamed its argument labels to match Android and Dart
(itemId / categoryId / itemIds), so the Swift bridge follows.

A story source no longer has to be dropped on the way to iOS: TrackingSource
there now takes TrackingSourceType, which carries `stories`. Dart gains
webPushDigest, so all three enums hold the same set.
The natives shipped: Android 2.37.0 (JitPack) and iOS 3.31.0 (CocoaPods). The
DEV-4409 local wiring — mavenLocal in three places and a :path pod pointing at a
sibling checkout — is gone, and the plugin podspec asks for REES46 3.31.0.

Both example apps build against the published artifacts.
Everything Dart sends arrives as a pigeon struct and has to become a native
type. That conversion had no tests, and it is exactly where the bridge can drop
a value silently — a story source used to be dropped there.

Seven tests over TrackingItemWire.native and TrackingSourceWire.native: field
mapping, the Int64 -> Int narrowing on quantity, every wire value Dart can send
resolving to a native case, an unknown type being dropped rather than guessed,
and the native enum holding nothing Dart cannot produce. The last two are the
regression guard for the three TrackingSourceType enums drifting apart.

Added a RunnerTests scheme: the Runner scheme also carries the patrol UI-test
target, which only compiles under `patrol test` and so breaks a plain
`xcodebuild test`. Run with:

    flutter pub get && cd ios && xcodebuild -workspace Runner.xcworkspace \
      -scheme RunnerTests -sdk iphonesimulator -destination '...' test
`dart format --set-exit-if-changed` is part of PR checks and these four files
were never run through it.
@Xyzcancer
Xyzcancer force-pushed the DEV-4409-standart-tracking-metod-unification branch from 5215002 to 27e9e20 Compare September 2, 2026 18:49
@Xyzcancer
Xyzcancer merged commit 044e558 into master Sep 2, 2026
2 of 3 checks passed
@Xyzcancer
Xyzcancer deleted the DEV-4409-standart-tracking-metod-unification branch September 2, 2026 18:59
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