Wrapper for Microsoft Clarity for mobile
Firstly register package installer in your MauiProgram.cs
builder.Services.AddMicrosoftClarity();then in App.xaml.cs inject IMicrosoftClarityService:
public partial class App : Application {
private readonly IMicrosoftClarityService _microsoftClarityService;
public App(IMicrosoftClarityService microsoftClarityService) {
InitializeComponent();
_microsoftClarityService = microsoftClarityService;
}
}and also override there method OnStart() to call _microsoftClarityService.Initialize with your project id.
protected override void OnStart() {
_microsoftClarityService.Initialize("<MicrosoftClarityProjectIdHere>");
base.OnStart();
}Because of MAUI and VS bugs:
- dotnet/macios#19229
- https://developercommunity.visualstudio.com/t/MAUI---Cannot-create-native-types-when-d/10180586
- potential workaround: dotnet/maui#10800 (comment)
it is not possible to run your app with hot-restart(direct local iOS deploy from VS for Windows)
So that you dont have to specify platform for this package and it's calls, also Windows and MacCatalyst are added with dummy implementations. When you call one of their methods you will always get:
truefor bool returnsnew List<>for collectionsstring.Emptyfor string values
- Library will throw exceptions only in case developer did some mistake
- in other cases, when there is some corrupted state it will return default value of that type.
This repo runs a daily pipeline that watches Microsoft's Clarity Android and iOS SDKs and tries to bump + re-wire this package automatically. The flow:
flowchart TD
A[Microsoft ships new Clarity SDK] --> B[06:00 UTC daily<br/>automatic-detect-sdk-updates.yml]
B --> C[Bump PR opened<br/>label: auto-bump]
C --> D[automatic-bump-and-wire.yml:<br/>build binding + diff API + build wrapper]
D --> E{Outcome?}
E -->|API unchanged<br/>wrapper compiles| F[Auto-merge as<br/>stable release]
E -->|API additions<br/>or wrapper breaks| G[Label: needs-wiring<br/>Ping @copilot<br/>with API diff]
E -->|Binding itself broken| H[Label: binding-broken<br/>Ping @copilot<br/>with binding-fix guide]
G --> K[Agent commits wiring]
H --> L{Agent can fix?}
L -->|yes| K
L -->|no| M[Agent adds label:<br/>needs-human]
K --> N[Human review + merge]
M --> N
F --> O[main updated]
N --> O
O --> R[release-please<br/>maintains release PR<br/>for wrapper version]
R --> S[Merge release PR<br/>tags vX.Y.Z]
S --> T[Manually run<br/>publish-*.yml workflows]
T --> U[NuGet.org]
classDef happy fill:#d4edda,stroke:#155724,color:#000
classDef warn fill:#fff3cd,stroke:#856404,color:#000
classDef human fill:#f8d7da,stroke:#721c24,color:#000
class F,O,U happy
class G,H,K warn
class M,N human
The only manual steps for you:
- Review and merge agent wiring PRs when
needs-wiringis applied - Fix binding-generator failures the agent escalates as
needs-human(rare) - Trigger the three
publish-*.ymlworkflows after each release tag
See .github/COPILOT_INSTRUCTIONS.md for the rules the agent follows.
Feel free to create an issue or pull request. In case you would like to do massive changes in the package please firstly discuss them in the issue because otherwise there is high chance that such big PR would be rejected.
This repository is licensed with the MIT license.
