开发者控制台
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

Flurry Analytics Component

 IV: Add Components for More Functionality

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

  1. Create an account with Flurry Analytics and get your API key.
  2. Copy your Flurry API key into a convenient place.

Step 2. Configure the Flurry Analytics Component

  1. 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).

  2. 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>
    
  3. Paste these strings in your app's custom.xml file (located inside res > values).

    The encrypted_flurry_api_key string will hold the encrypted version of your Flurry API key. The flurry_key_[#] strings are used to create the encryption.

Step 3. Encrypt your Flurry API Key

You must encrypt your Flurry API key.

  1. Open your app's custom.xml file (inside res > values).
  2. 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>
    
  3. In the Android View, expand the Utils > java > com > amazon > utils > security folder and open the ResourceObfuscationStandaloneUtility class.
  4. In the getRandomStringsForKey() method, enter the values you used for flurry_key_1, flurry_key_2, and flurry_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 for flurry_key_1.
    • furryBEAR2999 is the value used for flurry_key_2.
    • homer2YHfurrybaLL28_sneezun is the value used for flurry_key_3.
  5. In the getRandomStringsForIv() method, enter the values you used for flurry_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 for flurry_key_4.
    • someFlurryBlurry9911 is the value used for flurry_key_5.
    • yrrulFbackwardZZ44 is the value used for flurry_key_6.
  6. In the getPlainTextToEncrypt() method, insert your Flurry API key in place of Encrypt_this_text:

     private static String getPlainTextToEncrypt() {
            return "Encrypt_this_text";
        }
    
  7. Right-click the ResourceObfuscationStandaloneUtility.java file and select Run 'ResourceObfusc…main().
  8. Look for the encrypted result printed to the console. It will look something like this:

    Encrypted version of plain text 123456789 is Hgei944983ljdfHoaQ==
    
  9. 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>
    

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:

  1. Browse to your app's assets > configurations directory.
  2. Add a JSON file to this directory called FlurryCustomAnalyticsTags.json.
  3. Add the tags you want to customize using the following format:

    {
      "TAG": "value",
      "TAG": "value"
    }
    

    For example, to customize the ACTION_START_APP and ACTION_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