# Post-Install Analytics Google Play

## Before You Begin

Before you get started, you'll need to:

- Integrate the latest [Android SDK](/en/monetization/integrate/android/get-started/). Post-Install Analytics comes with SDK versions 5.0 and newer.



## Obtain Google Play Public Key

If you're setting up PIA for Google Play games, you'll also need to add your app's public key to a field on the game's **App Settings** page:

![](/assets/images/articles/2023_advertising_analytics_googleplay_001.jpg)

Here's how to find your public key:

1. Go to the Google Play [Developer Console](http://play.google.com/apps/publish) and sign in. Make sure that you sign in to the account from which the application you are licensing is published (or will be published).
2. In the **Application Details** page, locate the **Services and APIs** link and click it.
3. In the **Services and APIs** page, locate the** Licensing and In-App Billing** section. You'll see your public key for in-app billing on this page.



## Google Play PIA Integration

You'll find a sample project, **InAppPurchase**, that illustrates Google Play PIA functionality in our latest [Android SDK package](/en/monetization/get-started/#sdk-integration).

Our **InAppPurchase** sample project includes a **GoogleIAPTracking.java** file you can use to see PIA in action. **Note that there are several ways to handle the IAP flow**; below are highlights from the method our sample project uses:

1. Set up item(s) with SKU(s) in [Google Play Developer Console](http://play.google.com/apps/publish) and note SKU(s):
	![](/assets/images/articles/2023_advertising_analytics_googleplay_002.png)

2. Add SKU(s) to project (in **strings.xml**)
3. In `onCreate`, set up purchase flow for IAPs (one method is shown in line 54 of **GoogleIAPTracking.java**):
	![](/assets/images/articles/2023_advertising_analytics_googleplay_003.png)

4. Use Google API to make purchase (line 79):
	![](/assets/images/articles/2023_advertising_analytics_googleplay_004.png)

5. After successful purchase, store purchase information in inventory, as shown in sample app (line 99). Once inventory stores information successfully, send information to the Chartboost SDK via the `trackInAppGooglePlayPurchaseEvent` class (line 127):

	```
	CBAnalytics.trackInAppGooglePlayPurchaseEvent(item.getTitle(),

	    item.getDescription(),
	    item.getPrice(),
	    item.getCurrencyCode(),
	    purchase.getSku(),
	    data,
	    signature);
	```

6. Lastly, you can use a proxy service like Charles to verify that purchase data successfully reached our `api/post-install-event/ endpoint`. (Note: Even before this, null/empty purchase information will be flagged as such by errors in the log.)

