Add PostHog analytics integration for Android and iOS

Implement comprehensive analytics tracking across both platforms:

Android (Kotlin):
- Add PostHog SDK dependency and initialization in MainActivity
- Create expect/actual pattern for cross-platform analytics (commonMain/androidMain/iosMain/jvmMain/jsMain/wasmJsMain)
- Track screen views: registration, login, residences, tasks, contractors, documents, notifications, profile
- Track key events: user_registered, user_signed_in, residence_created, task_created, contractor_created, document_created
- Track paywall events: contractor_paywall_shown, documents_paywall_shown
- Track sharing events: residence_shared, contractor_shared
- Track theme_changed event

iOS (Swift):
- Add PostHog iOS SDK via SPM
- Create PostHogAnalytics wrapper and AnalyticsEvents constants
- Initialize SDK in iOSApp with session replay support
- Track same screen views and events as Android
- Track user identification after login/registration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-07 23:53:00 -06:00
parent 6cbcff116f
commit c334ce0bd0
44 changed files with 623 additions and 5 deletions

View File

@@ -14,6 +14,7 @@
1C81F2772EE416EF000739EA /* CaseraQLPreview.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 1C81F2692EE416EE000739EA /* CaseraQLPreview.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1C81F2822EE41BB6000739EA /* QuickLookThumbnailing.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C81F2812EE41BB6000739EA /* QuickLookThumbnailing.framework */; };
1C81F2892EE41BB6000739EA /* CaseraQLThumbnail.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 1C81F2802EE41BB6000739EA /* CaseraQLThumbnail.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1C81F3902EE69AF1000739EA /* PostHog in Frameworks */ = {isa = PBXBuildFile; productRef = 1C81F38F2EE69AF1000739EA /* PostHog */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -256,6 +257,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1C81F3902EE69AF1000739EA /* PostHog in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -450,6 +452,7 @@
);
name = Casera;
packageProductDependencies = (
1C81F38F2EE69AF1000739EA /* PostHog */,
);
productName = iosApp;
productReference = 96A3DDC05E14B3F83E56282F /* Casera.app */;
@@ -496,6 +499,9 @@
);
mainGroup = 86BC7E88090398B44B7DB0E4;
minimizedProjectReferenceProxies = 1;
packageReferences = (
1C81F38E2EE69698000739EA /* XCRemoteSwiftPackageReference "posthog-ios" */,
);
preferredProjectObjectVersion = 77;
productRefGroup = FA6022B7B844191C54E57EB4 /* Products */;
projectDirPath = "";
@@ -1198,6 +1204,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
1C81F38E2EE69698000739EA /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/PostHog/posthog-ios.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 3.35.1;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
1C81F38F2EE69AF1000739EA /* PostHog */ = {
isa = XCSwiftPackageProductDependency;
package = 1C81F38E2EE69698000739EA /* XCRemoteSwiftPackageReference "posthog-ios" */;
productName = PostHog;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 6A3E1D84F9F1A2FD92A75A6C /* Project object */;
}

View File

@@ -0,0 +1,15 @@
{
"originHash" : "47cbe4ef2adc7155b834c1fb5ae451e260f9ef6ba19f0658c4fcafd3565fad48",
"pins" : [
{
"identity" : "posthog-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/PostHog/posthog-ios.git",
"state" : {
"revision" : "fac9fc77380d2a38c3389f3cf4505a534921ee41",
"version" : "3.35.1"
}
}
],
"version" : 3
}