pushinbr / pam-native-analytics
Privacy-safe product analytics (Firebase Analytics without advertising identifiers) for PAM Native.
Package info
github.com/push-in/pam-native-analytics
Type:pam-native-plugin
pkg:composer/pushinbr/pam-native-analytics
Requires
- php: ^8.5
- pushinbr/pam-native: ^1.53.1
Requires (Dev)
- pushinbr/pam-native-testing: ^0.2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Privacy-safe product analytics for PAM Native.
Firebase Analytics with no advertising identifiers: ad signals stay denied and screens are reported only when you say so.
Install · Quick example · Platforms · Permissions · Docs · Issues
Install
Inside a PAM Native project, add only this capability:
pam composer require pushinbr/pam-native-analytics pam doctor --fix
New to PAM? Create a project with pam init my-app --template native (see the PAM Native overview), then come back here. Composer owns the manifest and the lockfile; pam composer runs it on PAM's verified PHP runtime.
Quick example
<?php use Pam\Native\Analytics\Analytics; Analytics::setConsent(); // analytics storage granted; ad_* always denied Analytics::setCollectionEnabled(true); // collection starts disabled Analytics::logEvent('content_share', ['post_type' => 1, 'share_channel' => 2]); Analytics::setScreen('Inbox'); // screen_view (screen_name = screen_class)
Every call is fire-and-forget. The optional completion receives AnalyticsOperationState: Succeeded, Failed or Unavailable.
Platform support
| Platform | Support | Notes |
|---|---|---|
| Android | API 24+ | firebase-analytics 23.2.0, firebase-common 22.2.0 |
| iOS | 15.0+ | firebase-ios-sdk 12.17.0: FirebaseAnalyticsCore, FirebaseCore |
| PAM Native | 1.0.0 to < 2.0.0 | From pam-native.plugin.json; PHP 8.5+ |
Permissions and requirements
| Platform | Declared by the plugin |
|---|---|
| Android | android.permission.ACCESS_NETWORK_STATE, android.permission.INTERNET, android.permission.WAKE_LOCK |
| iOS | No usage descriptions; Info.plist keys turn off automatic collection, screen reporting, IDFV and ad-network registration |
The plugin reuses the project's Firebase configuration: google-services.json on Android and GoogleService-Info.plist on iOS, which the host already uses for push. Without it every call is a silent no-op that answers Unavailable.
Privacy
- Android drops
AD_ID,ACCESS_ADSERVICES_AD_IDandACCESS_ADSERVICES_ATTRIBUTION, and disables ADID/SSAID collection. - iOS links
FirebaseAnalyticsCore(no IDFA support) and disables IDFV collection and ad-network registration. - Ad storage, ad user data and ad personalization are denied by default and stay denied:
setConsent()cannot grant them. - Automatic screen reporting is off. Screens come only from
setScreen(). - Event and parameter names follow the Analytics limits: up to 40 characters, at most 25 parameters, text values cut to 100 characters, and no
firebase_,google_orga_prefixes.
With pam-native-firebase
pushinbr/pam-native-firebase links the FirebaseAnalytics Swift product, which pulls GoogleAppMeasurement with GoogleAppMeasurementIdentitySupport (IDFA) and GoogleAdsOnDeviceConversion. Swift Package Manager links the union of both plugins' products, so an app that installs both ships IDFA support on iOS and this plugin's "no IDFA" guarantee no longer holds. Both plugins also drive the same Analytics singleton, so collection and consent set by one apply to the other.
- Android stays clean: this plugin's manifest removes the AD_ID and AdServices permissions and disables ADID/SSAID for the whole merged app.
- iOS: use this plugin alone for analytics, or keep
pam-native-firebasewithout itsFirebaseAnalyticsproduct (switch it toFirebaseAnalyticsCore). Do not ship both products in one app.
Tests
composer test. Without vendor/, point PAM_NATIVE_SRC and PAM_NATIVE_TESTING_SRC at the framework and testing sources.
Docs
Part of the PAM ecosystem
PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.
| PAM | PAM Desktop | PAM Native | Ecosystem |
|---|---|---|---|
| the runtime and CLI | native desktop apps in PHP | native Android and iOS apps in PHP | every official package and plugin |
Docs: push-in.github.io/pam-docs · Issues
Apache License 2.0 · Made in Brazil by Pushin