Integration
Prerequisites
- UWP apps
- Make sure that your UWP app targets version is not less than, Windows 10 Build 16299 (Fall Creators Update, version 1709)
Add the SDK to your app
- Before you can add Zoho Apptics to your UWP app, you need to create a Project and add your app.
- Download the apptics-config.json, and add it to your root project.
- Change the build action property of JSON file into an embedded resource.
- Right-click on the apptics-config.json file and select Properties.
- Change the build action to an embedded Resource.
- Add a class file named "AppticsInterface.cs" in the project root.
- Download the Apptics windows library from this link, you will get a zip file. Extract the files.
- Add reference to "AppticsUwpBase.dll" , "AppticsWindowsBase.dll",and "AppticsAnalytics.dll" .
- Add more references like "AppticsAppUpdate.dll", if you want to use the In-AppUpdate feature.
- Add following packages from NuGet.
- "System.Json" 4.4 or latest
- "JWT" 8.2.3 or latest
- Build the project, then go for the next step to add a build event.
Post Build event to complete integration
- Copy the "AppticsCommand.exe" file to any folder as per your wish (I am referring here "C:\TempReferences" ), here "TempReferences" is a folder in "C" drive. This can be in any folder on your computer.
- Open the project properties > Build Events > Post build event > add the following command.
- "C:\TempReferences\AppticsCommand $(ProjectDir) $(ProjectPath) $(TargetDir)"
- Build your project.
- After a successful build, apptics-config.json, and AppticsInterface.cs should be updated with the latest values from the server. This indicates that your project is almost ready.
Integrate Apptics with your code
- Open your app App.xaml.cs file and go to OnLaunched event (create if not), and add the following line of code, below your frame register.
CopiedAppticsUwpBase.Initializer.Instance.Init(this, (int)AppticsMode.Development, AnonymityType.PseudoAnonymous, true);
Params:
- application: The UWP application instance
- mode: Supported modes i.e. 0 - Development, 1 - Production, and 2 - Testing
- anonymity type: None - Will only track with the user identity; Pseudoanonymous - Will be tracked with or without user identity
- defaultTrackingState: True - To track before getting user consent; False - To track after getting user consent
Sample code snippet: