User profiling for Windows apps
You can add multiple users for the analytics data but all the data will be mapped to a single primary user (by default).
You can change the primary user at runtime.
You need to change the primary user before you remove the current primary user. If no primary user found, data will be mapped to anonymous.
Add the user using the below function.
For UWP apps
Copiedawait AppticsAnalytics.User.UserUtil.SetUser("UserId", IsPrimaryuser);
For WinUI apps
Copiedawait WinUIAppticsAnalytics.User.UserUtil.SetUser("UserId", IsPrimaryuser);
- Show the user consent popup using the below code. You can decide to show the consent popup only once for all users, or once for each user.
For UWP apps
Copiedawait AppticsAnalytics.User.UserUtil.ShowUserConsentPopup( bool ShowOnlyOnce);
For WinUI apps
CopiedWinUIAppticsUIComponents.PopUps.ShowUserConsentPopup(bool ShowOnlyOnce);
- Remove a user, using the below code.
For UWP apps
Copiedawait AppticsAnalytics.User.UserUtil.RemoveUser("UserId");
For WinUI apps
Copiedawait WinUIAppticsAnalytics.User.UserUtil.RemoveUser(string UserId, bool forceRemove)
- To check for a primary user, use the below code.
For UWP apps
Copiedawait AppticsAnalytics.User.UserUtil.GetPrimaryUser();
For WinUI apps
Copiedawait WinUIAppticsAnalytics.User.UserUtil.GetPrimaryUser();
- To change the primary user, use the below code.
For UWP apps
Copiedawait AppticsAnalytics.User.UserUtil.ChangePrimaryUser(string UserId);
For WinUI apps
Copiedawait WinUIAppticsAnalytics.User.UserUtil.ChangePrimaryUser(string UserId);
Customize the consent pop-up
Consent pop-up can be customized based on your requirements. To customize the consent pop-up, you can apply certain style elements to the same.
For UWP apps
CopiedCustomStyle customStyle = new CustomStyle();
Style buttonStyle = new Style(typeof(Button));
buttonStyle.Setters.Add(new Setter(Button.ForegroundProperty, Colors.Red));
customStyle.ButtonStyle = buttonStyle;
AppticsUwpBase.UI.Customization.SetUserConsentStyle(customStyle);
For WinUI apps
CopiedCustomStyle customStyle = new CustomStyle();
Style buttonStyle = new Style(typeof(Button));
buttonStyle.Setters.Add(new Setter(Button.ForegroundProperty, Colors.Red));
customStyle.ButtonStyle = buttonStyle; WinUIAppticsUIComponents.Customization.SetUserConsentStyle(ApplyCustomStyle());(customStyle);
Similarly, crash consent pop-up can be customized too.
CopiedCustomStyle customStyle = new CustomStyle();
Style buttonStyle = new Style(typeof(Button));
buttonStyle.Setters.Add(new Setter(Button.ForegroundProperty, Colors.Red));
customStyle.ButtonStyle = buttonStyle;
AppticsUwpBase.UI.Customization.SetCrashConsentStyle(customStyle);
Add privacy settings
You can use Apptics' settings to monitor three parameters, i.e., In-app usage stats, Crash reporting, and Enabling user id.
The mentioned parameters can be managed in two ways.
- Through the SET & GET method.
- Through the Settings control that will manage all the values.
SET and GET method
- To track the in-app usage, call the below method and set the value to True. If the value is set to False, in-app usage won't be tracked.
SET the value
CopiedAppticsWindowsBase.Analytics.AnalyticsHelper.SetAnalaticsTracking(bool OnOff)
GET the value
CopiedAppticsWindowsBase.Analytics.AnalyticsHelper.GetAnalaticsTracking();
- To report a crash, call the below method and set the value to True. If the value is set to False, the crashes won't be reported.
SET the value
CopiedAppticsWindowsBase.Analytics.AnalyticsHelper.SetCrashTracking(bool OnOff)
GET the value
CopiedAppticsWindowsBase.Analytics.AnalyticsHelper.GetCrashTracking();
- To enable the user id, call the below method and set the value to True. If the value is set to False, the user id won't be enabled.
- If the user id is enabled, it will be included in the Crash reports. If not, then the crashes will be reported anonymously.
SET the value
CopiedAppticsWindowsBase.Analytics.AnalyticsHelper.SetIncludeUserId(bool OnOff)
GET the value
CopiedAppticsWindowsBase.Analytics.AnalyticsHelper.GetIncludeUserId();
You can also use your own custom pop-up and use the Apptics SDK.
- Call the below SDK functions to present the custom pop-up.
Settings control
Follow the below steps to manage and monitor the three parameters, i.e., in-app usage, crash reporting, and enabling user id.
- Include the namespace xmlns:apptics="using:AppticsAnalytics.Settings" in the XAML page.
- Include the code to plug-in the settings control into your application.
Copied<apptics:SettingsControl></apptics:SettingsControl>