pug_flutter 0.2.0
pug_flutter: ^0.2.0 copied to clipboard
Open-source product analytics SDK for Flutter: tracks app opens and installs, and screen views on Android and iOS, with identity, sessions and a consent gate.
0.2.0 #
- Breaking: a
Durationproperty, including the durations the typedPug.track.*methods take, is sent as a protobufDuration, to the microsecond, which the server stores as a number of seconds, so it can be summed, averaged and compared. It used to be sent as text, such as"90.5s", rounded to the millisecond, so filters and charts on that text do not match the new events. ADurationtrait inPug.identifyis sent as a number of seconds, and a duration beyond ±10,000 years is dropped with a warning. - A self-hosted server and events worker must be at pug v0.0.65 or later first: an older server drops the events that carry a duration (before v0.0.55, their whole batch), and an older events worker sends every batch holding one to its dead-letter queue after the server has accepted it, so the SDK logs nothing.
- Breaking: a custom
PugTransportreceives aDuration, in event properties and identify traits, as aPropertyValueof kinddurationValuewhosevalueis anintof microseconds, where it used to receivestringValuetext such as"90.5s".Event.toJson()andPropertyMapperchange the same way, andPropertyValue.durationis new. Pug.identify()rejects an external ID that starts withcrawler-, as it does one that starts withcookieless-: the server reserves both for IDs it derives itself, refuses them in identify and drops any event carrying one. A stored external ID with either prefix is discarded, so that user is anonymous until the nextidentify(), and queued events carrying one are dropped.Pug.track('crawler_request')is dropped with a warning, as the Android SDK drops it: the server reserves that kind for its server-side crawler collectors and drops every one an SDK sends.- Going back to 0.1.1 sends the durations of events still queued as text holding a number of microseconds.
- Breaking: on iOS,
$deviceModelis the hardware identifier, such asiPhone16,1, where it used to be the device_info_plus plugin's marketing name,iPhone 15 Pro, or justiPhoneoriPadwhere the plugin had no name. The server, from pug v0.0.66, names$devicefrom the identifier with AppleDB's names, which often differ from the plugin's:iPhone 13 mini, notiPhone 13 Mini. Filters and breakdowns on the old names match none of the new events, in$deviceModelor in$device. macOS still sends the marketing name. - An iOS app running on a Mac sends no
$deviceModel, since the identifier it reads there is the Mac's CPU architecture,arm64. With device_info_plus 11.2.0 or later it reports$deviceTypeasdesktop, as the iOS SDK does, where it used to reportmobile. - On a self-hosted server before pug v0.0.66, iOS events keep the identifier in
$deviceModeland get no$device.
0.1.1 #
- pub.dev lists web support.
lib/src/auto_properties.dartimporteddart:iounconditionally, which kept web off the package's platforms though the SDK runs there;Platformnow comes from a conditional import. Nothing changes at runtime. - The package description, topics, homepage, issue tracker and documentation links now say what the package is, for pub.dev search, and the README says which platforms get screen views.
0.1.0 #
- Drop, with a warning, an event whose kind the server rejects: a kind may only
contain letters, digits,
_,.and-, soOrder Completedorsignup:startedis dropped. Drop, with a warning, a property whose key starts with$, which is reserved for auto-properties, and send its event without it; and drop an auto-property from a customPugAutoPropertyProviderwhose key does not start with$. The server drops an event that breaks one of these rules, and before pug v0.0.55 it failed the whole batch, losing every event sent with the bad one. - Warn when the server accepts only part of a batch, with the count for each reason and, for each invalid event, its kind and the rules it broke. Those events used to be lost with no log.
- Retry a batch whose 200 response isn't protobuf, such as a captive portal's
sign-in page, as the Android and iOS SDKs do. It used to be committed as
delivered, losing its events. An
identifyanswered that way, or with a body that isn't its response, now fails with a log instead of counting as done, so the nextidentifystill merges the anonymous profile. - The typed
Pug.track.*methods take aDurationfor the media and chat durations:positiononvideoPlay,videoPause,audioPlayandaudioPause,fromPositionandtoPositiononvideoSeekedandaudioSeeked,durationonchatCallLeftandmuteDurationonchatMemberMuted. ADurationinpropsorextrasis sent too. Each is sent as seconds, such as"90.5s", rounded to the millisecond, as the Android and iOS SDKs send it; it used to be dropped with a warning.WellKnownPropertyTypehas a newdurationvalue, so an exhaustiveswitchover it needs a case for it. - On Linux,
$deviceManufacturerand$deviceModelare no longer sent. They held the distribution's name from os-release, such asUbuntu 24.04.1 LTS, rather than the hardware's.
0.0.8 #
app_installnow carriesinstallSource, aspackage_info_plusreports it: on Android the package name of the app that started the install, such ascom.android.vendingfor Google Play, and on iOScom.apple,com.apple.testflightorcom.apple.simulator, inferred from the App Store receipt path. It is left out when there is none, as with anadb install, on web and desktop, and with a customPugAutoPropertyProvider.
0.0.7 #
- Add
PugOptions.httpClientto send the SDK's requests through anypackage:httpclient. They otherwise go throughdart:io'sHttpClienton Android, iOS, and desktop. PassCupertinoClient(cupertino_http),CronetClient(cronet_http), or a client the app already configures. The app owns the client: the SDK never closes it, so the same one can be reused acrossPug.destroy()andPug.init(). It is ignored, with a warning, when a customtransportis also set. - Fix Flutter web, where no events were sent. Building each event read
Platform.operatingSystem, which throws on web, so everytrack()call and every automatic event failed, and the default logger discarded the error. - On web,
$osand$osVersionnow come from the browser's user-agent client hints, read the way@pug-sh/browserreads them. They are omitted in browsers without client hints (Safari, Firefox). - Fix the UUIDv7 IDs generated on web. Compiled to JavaScript, their timestamp lost its top 16 bits, so event, session, device, and anonymous IDs did not sort by time.
0.0.6 #
- Regenerate the protobuf code for the backend's cookieless contract. This alone
changes nothing on the wire: the SDK never sets the new
Event.cookielessflag and ignores the newBatchCreateResponsefields. Pug.identify()now rejects an external ID that starts withcookieless-, which the server reserves for its own cookieless identities. As with other invalid input, the call is logged and completes without sending.- Discard a stored external ID that starts with
cookieless-, left by an identify the server accepted before reserving the prefix, and drop queued events that carry it. Either would get event batches from the device rejected and dropped whole. The user is treated as anonymous until the nextidentify(). - Errors the
Pugfacade catches (identify, reset, rotate, flush, destroy, and opting in or out) are now logged through the configuredPugLoggerinstead ofdebugPrint. - Log a SharedPreferences write that reports
false, which is how Android reports a failed commit, not only one that throws. - Stop quoting a corrupt stored value in the debug log, where a corrupt profile could expose an external ID.
0.0.5 #
- Breaking: remove campaign capture, push device registration, and device
subscription from the public API. The backend does not accept them yet, so
shipping the entry points invited calls that could not succeed. The code stays
in the package and the features will be turned back on in a later release.
package:pug_flutter/pug_flutter.dartno longer exportsPugPush,PushProvider,PushSubscription,PushSubscribeOptions,PugLinkProvider,AppLinksPugLinkProvider, orcampaignPropertiesFromUri.PugOptionsno longer hasautoCaptureCampaignsorlinkProvider, and no campaign auto-properties ($utmSource,$gclid, and the rest) are attached to events.PugTransportno longer declaressubscribeDevice; a custom transport does not have to implement it. It moved to an internalPugDeviceTransportthatConnectPugTransportstill implements.
- The
notification_clicked,notification_received, andnotification_dismissedevent kinds are unaffected: they are ordinary events on the live events endpoint, still reachable throughPug.track.*andPugEventNames. - Add automatic
app_installandapp_updatetracking, controlled by the newPugOptions.autoInstallEvents(default on, independent ofautoTrack).app_installis emitted on the first launch the SDK sees on a device, andapp_update(carryingpreviousVersion) on the first launch after the app version changes. Detection compares the$appVersionauto-property against a version persisted under__pug_<projectId>_last_version__, so it is inactive when a customPugAutoPropertyProvidersupplies no app version. The install event is suppressed when other Pug state is already on the device, so adding this SDK to an app that already used Pug does not report its existing users as new installs.Pug.destroy()clears that state, so a destroy/re-init cycle does look like a fresh install.
0.0.4 #
- Add the
$deviceTypeauto-property, reporting the form factor astv,mobile, ordesktop. Android TV is detected from the device's system features rather than the operating system, which reports plainandroidthere;$platformstaysandroidso the value keeps matching the other Pug SDKs. Omitted on web, where the host device is not detectable from Dart. - Fix
$deviceModelshipping the literal"Unknown device"/"Unknown Model"placeholders thatdevice_info_plusreturns when its marketing-name lookup misses. Those now fall back to the device identifier (iPhone,MacBookPro18,3). macOS was affected on any Mac absent from the plugin's table, which previously had no placeholder check at all. - Omit
$osVersionwhen the device-info payload has no version, instead of sending an empty string that overwrote thePlatform.operatingSystemVersionfallback. - Derive
$platformfromPlatform.operatingSysteminstead ofdefaultTargetPlatform, so$platformand$osare one value from one source. No change to the value on any supported platform: this removes a lookup table, a debug-only spoofing vector, and aFlutterErrorthatdefaultTargetPlatformraises on targets outside its six-member enum. - Include the underlying error in the auto-property warning logs, which previously reported only that a category had failed.
0.0.3 #
- Fix the
$platformauto-property to send the cross-SDK lowercase value set:web,android,ios,macos,linux,windows,fuchsia. It previously came fromdefaultTargetPlatform.name, which keeps the enum's casing, so this SDK reportediOS/macOSwhere the rest of the Pug SDKs sendios/macos. The backend promotes$platforminto a dedicated column verbatim, so the mismatch split one platform into per-SDK buckets in any cross-SDK breakdown. - Fix
$platformon Flutter web, which reported the browser's host OS rather thanweb: a web app on an iPhone was indistinguishable from native iOS traffic.$platformis now alwayswebthere, and equals$oson every native target. - Document the auto-properties attached to every event in the README.
Dashboards, filters, or saved segments that match the old iOS/macOS casing
(or that treated Flutter web traffic as iOS) need updating to the lowercase set.
0.0.2 #
- Replace the
connectrpcdependency with a hand-rolled native Connect unary transport overpackage:http. This drops thedependency_overrides: protobuf: ^6.0.0workaround that 0.0.1 forced consumers to add: the SDK now resolves cleanly against theprotobuf6.x runtime the generated code requires. Connect error bodies are parsed forcode/message; permanent codes drop the batch while transient/unknown errors (e.g.SocketException) retry. - Add a runnable example app under
example/.
0.0.1 #
Initial release.
- Analytics
trackAPI: untypedPug.track('kind', props: {...})plus codegen'd typedPug.track.<event>(...)methods for well-known events, with compile-time checking of required fields and value types. - Identity, sessions, and device registration:
init,identify,reset,rotate,flush, and asyncdestroy()(awaits a best-effort final flush before teardown; the singleton detaches synchronously so a follow-upinit()is safe). identify()first-call anonymous-ID merge and device-ID linking.identify()never throws;init()throws synchronously only on invalid input (emptyprojectId/apiKey) and otherwise logs and swallows setup failures.- Batched binary-protobuf transport over Connect with lock/commit/rollback queue persistence; offline/transient failures retry, permanent failures drop.
- Tracking-consent gate (opt in/out, optional persistence) over track, identify, and automatic capture.
- Mobile auto-properties, app-lifecycle auto-tracking (
app_open/app_close), and automatic campaign capture from app/deep links (requiresapp_links6.x). - Auto page-views via
PugRouteObserver: route changes emitscreen_view(with ascreenNameproperty) on iOS/Android andpage_viewon web; every event also carries$url/$referrerauto-properties. Desktop emits no navigation event. $timezonereports the IANA identifier (e.g.Asia/Kolkata), falling back to the platform abbreviation when unavailable;$deviceNameis intentionally not sent (PII).- Provider-neutral push registration with notification
received/clicked/dismissed helpers (all sent immediately; a missing, empty, or
non-string
campaignIddefaults to(unknown)). - Pluggable storage (
SharedPreferencesdefault, in-memory opt-out), logger, clock, and ID generator.