The Webtrends SDK is a library for Android that enables easy integration with Webtrends Optimize. This guide will walk you through the initial setup process, from integrating the SDK with your project, to sending events to Webtrends.
Installing the SDK
Download the Mobile Application Analytics library for Android from the Developer Network.
The SDK is packaged into a ZIP file. Once extracted, you will find:
Import the SDK into Your Project
Once you have an Android project, adding the SDK is simple. These instructions will be based on using Android Studio, but they may easily be adapted for use with Eclipse or any other Android IDE.
- Once the SDK is downloaded and extracted, open up your Android project.
- Select your project root, then choose Project Structure… from the File menu.
- Click the **+** sign on the top left to add a new module.
- Select Import .JAR/.AAR Package from the list of options and click Next.
- Browse to the extracted webtrends-sdk-release-xxx-lib.aar file. This filename will vary from version to version. Click Finish to import.
- With your main module (your application) selected, click the Dependencies tab.
- Click the **+** sign at the bottom to add a Module dependency to your application.
- Select the module that you just imported and click OK.
Adding the webtrends.xml file to Your Project
Create a new webtrends.xml file or import the included webtrends.xml file into your project’s resources (res/values/) directory. The webtrends.xml file contains required and optional configuration settings. The only required entries in this file are:
Open the file for editing and change the following values:
1 <?xml version="1.0" encoding="utf-8"?>
3 <string name="wt_opt_project_locations">COMMA_SEPARATED_LIST_OF_OPTIMIZE_PROJECT_LOCATIONS</string>
4 <string name="wt_opt_domain_id">YOUR_DOMAIN_ID</string>
5 <string name="wt_opt_key_token">YOUR_KEY_TOKEN</string>
6 <string name="wt_opt_staging_mode">TRUE_OR_FALSE</string>
7 <string name="wt_opt_account_guid">YOUR_ACCOUNT_GUID</string>
Your project is now configured to use the Webtrends Mobile SDK.