User Profiling
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 cannot remove the current primary user. During sign-out, you will have to change to the primary user and then call remove user.
Add the user using the below function.
Copiedawait AppticsAnalytics.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.
Copiedawait AppticsAnalytics.User.UserUtil.ShowUserConsentPopup( bool ShowOnlyOnce);
- Remove a user, using the below code.
Copiedawait AppticsAnalytics.User.UserUtil.RemoveUser("UserId");
- To check for a primary user, use the below code.
Copiedawait AppticsAnalytics.User.UserUtil.GetPrimaryUser();
- To change the primary user, use the below code.
Copiedawait AppticsAnalytics.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.
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);
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
CopiedAppticsAnalytics.AppticsTracker.SetAnalaticsTracking(bool OnOff)
GET the value
CopiedAppticsAnalytics.AppticsTracker.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
CopiedAppticsAnalytics.AppticsTracker.SetCrashTracking(bool OnOff)
GET the value
CopiedAppticsAnalytics.AppticsTracker.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
CopiedAppticsAnalytics.AppticsTracker.SetIncludeUserId(bool OnOff)
GET the value
CopiedAppticsAnalytics.AppticsTracker.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>