Flurry Analytics Component
Flurry provides analytics for your Android app that shows details related to media playback. According to Flurry Analytics:
The Flurry Analytics SDK provides you with the tools and resources you need to gain a deep level of understanding about your users’ behavior in your apps. Set up advanced analysis of complex events, with metrics, segments and funnels to better track your users’ habits and performance.
Follow the sections below to configure Flurry Analytics.
- Step 1. Get a Flurry API Key
- Step 2. Configure the Flurry Analytics Component
- Step 3. Encrypt your Flurry API Key
- Checking Flurry in Your Logs
- Customize the Tag Names
Step 1. Get a Flurry API Key
- Create an account with Flurry Analytics and get your API key.
- Copy your Flurry API key into a convenient place.
Step 2. Configure the Flurry Analytics Component
-
Load the Flurry Analytics Component into your app. See Add or Remove a Component.
Be sure to remove any other analytics components that are loaded in your app (such as Crashlytics, OmnitureAnalyticsComponent, ComScoreAnalyticsComponent, or LoggerAnalyticsComponent).
Note: You can load only one component per interface. For example, you cannot load both the Flurry Analytics component and the Omniture Analytics component, because both components use the sameIAnalytics
interface. For a list of the components by interface, see Components Overview. -
Go to FlurryAnalyticsComponent > res > values > custom.xml and copy the following strings:
<string name="encrypted_flurry_api_key">YOUR_ENCRYPTED_FLURRY_API_KEY</string> <string name="flurry_key_1">flurry_random_key_1</string> <string name="flurry_key_2">flurry_random_key_2</string> <string name="flurry_key_3">flurry_random_key_3</string> <string name="flurry_key_4">flurry_random_key_4</string> <string name="flurry_key_5">flurry_random_key_5</string> <string name="flurry_key_6">flurry_random_key_6</string>
-
Paste these strings in your app's custom.xml file (located inside res > values).
Tip: As a best practice to integrate future updates, always copy values from the component's XML files into your app's custom.xml file. Your app's XML values will overwrite any values in your component's XML files.The
encrypted_flurry_api_key
string will hold the encrypted version of your Flurry API key. Theflurry_key_[#]
strings are used to create the encryption.
Step 3. Encrypt your Flurry API Key
You must encrypt your Flurry API key.
- Open your app's custom.xml file (inside res > values).
-
Type a random alphanumeric string for each of the
flurry_key_[#]
values. For example:<string name="flurry_key_1">flurryblurry8837</string> <string name="flurry_key_2">furryBEAR2999</string> <string name="flurry_key_3">homer2YHfurrybaLL28_sneezun</string> <string name="flurry_key_4">curry88fl@vrczng</string> <string name="flurry_key_5">someFlurryBlurry9911</string> <string name="flurry_key_6">yrrulFbackwardZZ44</string>
- In the Android View, expand the Utils > java > com > amazon > utils > security folder and open the ResourceObfuscationStandaloneUtility class.
-
In the
getRandomStringsForKey()
method, enter the values you used forflurry_key_1
,flurry_key_2
, andflurry_key_3
respectively.For example, assuming these first 3 keys are the ones displayed in the previous code sample, you would enter the following:
private static String[] getRandomStringsForKey() { return new String[]{ "flurryblurry8837", "furryBEAR2999", "homer2YHfurrybaLL28_sneezun" }; }
In this example, the values are as follows:
flurryblurry8837
is the value used forflurry_key_1
.furryBEAR2999
is the value used forflurry_key_2
.homer2YHfurrybaLL28_sneezun
is the value used forflurry_key_3
.
-
In the
getRandomStringsForIv()
method, enter the values you used forflurry_key_4
,random_key_5
,random_key_6
respectively. For example:private static String[] getRandomStringsForIv() { return new String[]{ "someFlurryBlurry9911", "calypsoIslandShipBLLd99", "yrrulFbackwardZZ44" }; } }
In this example, the values are as follows:
someFlurryBlurry9911
is the value used forflurry_key_4
.someFlurryBlurry9911
is the value used forflurry_key_5
.yrrulFbackwardZZ44
is the value used forflurry_key_6
.
-
In the
getPlainTextToEncrypt()
method, insert your Flurry API key in place ofEncrypt_this_text
:private static String getPlainTextToEncrypt() { return "Encrypt_this_text"; }
- Right-click the ResourceObfuscationStandaloneUtility.java file and select Run 'ResourceObfusc…main().
-
Look for the encrypted result printed to the console. It will look something like this:
Encrypted version of plain text 123456789 is Hgei944983ljdfHoaQ==
-
Copy your encrypted Flurry API key and paste it into the
encrypted_flurry_api_key
string's value in your app's custom.xml file. For example:<string name="encrypted_flurry_api_key">Hgei944983ljdfHoaQ==</string>
Tip: Save your random keys in a safe place, such as your company wiki, so that you always have an easy way to retrieve them. You will need these keys to decrypt the value.
Flurry Analytics is now integrated into your app and will start sending in information about events.
Checking Flurry in Your Logs
When you build your app, view logcat with a filter on the word "flurry" to see how the Flurry Analytics Component gets triggered with events.
Although it takes several hours before the activity data populates in Flurry Analytic's dashboards, you can see event logs in a matter of minutes. In Flurry Analytics, go to Events > Event Logs.
Customize the Tag Names
You can customize the names of the analytics tags. (Tags are action or attribute names). Customizing the names can make it easier to identify activities you're interested in.
The complete list of analytics tags are available in AnalyticsInterface > java > com.amazon.analytics > AnalyticsTags.java
.
Here's an example tag:
public static final String ACTION_START_APP = "ACTION_START_APP";
ACTION_START_APP
(on the left) is the tag, and ACTION_START_APP
(on the right) is how the tag appears in your analytics. In this case, it's the same. You can customize this term with a more friendly, meaningful name.
To customize these tags with your own names:
- Browse to your app's assets > configurations directory.
- Add a JSON file to this directory called FlurryCustomAnalyticsTags.json.
-
Add the tags you want to customize using the following format:
{ "TAG": "value", "TAG": "value" }
For example, to customize the
ACTION_START_APP
andACTION_SEARCH
tags, add them like this:{ "ACTION_START_APP":"Start App", "ACTION_SEARCH": "Search" }
The values on the left map to the analytics tags in AnalyticsTags.java. The values on the right map to the new values for the tags.
If you add a tag that is not customizable, you will see a warning in the logs indicating that the tag cannot be customized. The customization will be ignored.
Last updated: Apr 06, 2017