<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abhishek Gokhale on Medium]]></title>
        <description><![CDATA[Stories by Abhishek Gokhale on Medium]]></description>
        <link>https://medium.com/@abhishek.gokhale_1855?source=rss-619aa0f27336------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*soajb42Dl8ejZzzQ_eGyNA.png</url>
            <title>Stories by Abhishek Gokhale on Medium</title>
            <link>https://medium.com/@abhishek.gokhale_1855?source=rss-619aa0f27336------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 04:40:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhishek.gokhale_1855/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[In-App Purchase Analytics with Python]]></title>
            <link>https://medium.com/stick-sports/in-app-purchase-analytics-with-python-b2303b66016b?source=rss-619aa0f27336------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2303b66016b</guid>
            <category><![CDATA[in-app-purchase]]></category>
            <category><![CDATA[mobile-games]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[pandas]]></category>
            <dc:creator><![CDATA[Abhishek Gokhale]]></dc:creator>
            <pubDate>Fri, 15 Mar 2019 10:16:01 GMT</pubDate>
            <atom:updated>2019-03-15T12:20:53.974Z</atom:updated>
            <content:encoded><![CDATA[<h3>Developer’s Blog: In-App Purchase Analytics with Python</h3><p>In this third installation of our Developer’s Blog series (in case you missed out, read the <a href="https://medium.com/stick-sports/developers-blog-2018-roundup-e502bca8ccc3">first</a> and <a href="https://medium.com/stick-sports/optimising-games-for-android-689e0965d8b5">second</a> posts from this series) we’d like to discuss In-App Purchases (IAPs), Analytics and Python (because making games is not just about creating and playtesting but also understanding how our gamers like to play). We’ll walk through two examples of IAP Analytics using Python. The first is a heatmap of IAP transactions created using <a href="https://pandas.pydata.org/">Pandas</a><strong> </strong>and <a href="https://seaborn.pydata.org/">Seaborn</a>. The second is an <a href="https://docs.aws.amazon.com/lambda/latest/dg/python-programming-model-handler-types.html">AWS Lambda Python function</a> for monitoring IAP validation failures.</p><p>Before diving into the exciting world of analysing data from in-app purchases, let’s set the scene. An in-app purchase is a significant event in a free-to-play mobile game. The IAP transaction delivers value to the user by unlocking new content or special features whilst allowing the app developer to monetise their app. We want to analyse these transactions because they can reveal insights about user behaviour or transactional anomalies. In terms of tools, we like Python for its versatility, ease of use and rich ecosystem of <a href="http://chris35wills.github.io/courses/pydata_stack/">open-source libraries</a>.</p><h3>Visualising IAP Transactions</h3><p>Analysing IAP transactions by day &amp; hour can enable more precise targeting of in-app offers (for example, to schedule promotions on a specific day &amp; hour when more users are more likely to make a purchase). For this purpose, we obtained a sample of timestamped IAP transaction logs from Google Play Store as CSV files and processed them using Pandas. Pandas is our go-to tool for data manipulation and analysis. Ingesting dozens of CSV files into a Dataframe is a breeze with Pandas’ <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html">read_csv</a><strong> </strong>function wrapped inside of a for-loop.<strong> </strong>As IAP transactions are often reported in a different timezone to the user’s locale, performing timezone conversions is easy with Pandas’ <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.TimedeltaIndex.html">TimedeltaIndex</a><strong> </strong>facility.</p><p>After counting transactions grouped by day &amp; time and min-max scaling to [0,1] interval, we can plot the heatmap shown below using Seaborn’s <a href="https://seaborn.pydata.org/generated/seaborn.heatmap.html">heatmap</a> function.<strong> </strong>We like Seaborn because it builds on top of <a href="https://matplotlib.org/">Matplotlib</a><strong> </strong>with more options for beautiful and eye-catching <a href="https://seaborn.pydata.org/examples/index.html">statistical data visualisations</a>. So for this sample of users, Sundays at 7 PM seem to be the most popular time for IAPs while Sundays at 5 AM seem to be the least popular!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DkWAhsB5SwG5-Rz7w6QURw.png" /><figcaption>A Seaborn heatmap mapping IAP transactions by day &amp; time for a sample of users</figcaption></figure><h3>Monitoring Validation Failures</h3><p>IAP validation failures are important to address not only because failed transactions represent lost revenue for an app developer, but more importantly failed transactions can negatively affect user experience and can impact on user retention. A cloud function is a great way of automating repetitive tasks and works great for monitoring validation failures. The flow of our cloud function is depicted below. We pulled internal validation logs from a SQL database into a Pandas Dataframe with Pandas’ handy <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_sql.html">read_sql</a><strong> </strong>function. Then, we processed them in-memory and sent an output message with basic summary statistics to a designated Slack channel using the <a href="https://slack.dev/python-slackclient/">Slack Developer Kit for Python</a>.</p><p>Finally, the cloud function was set to be triggered every day at a specific time using a cron job service. At the time of writing the Python 3 runtime for AWS Lambda only includes Amazon’s Boto 3 SDK. Other third-party libraries must be included separately in a deployment package file. Since <a href="http://www.numpy.org/">NumPy</a> is a dependency for Pandas (and deployment packages needing NumPy must be built using the same OS as the Lambda environment), we opted to build our deployment package using an <a href="https://hub.docker.com/_/amazonlinux">Amazon Linux Image</a> inside of a <a href="https://www.docker.com/resources/what-container">Docker container</a>. <a href="https://medium.com/@samme/setting-up-python-3-6-aws-lambda-deployment-package-with-numpy-scipy-pillow-and-scikit-image-de488b2afca6">Here’s</a> a great blog post with a step-by-step guide that we found helpful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*-6vGB2hzQ9Fr3-DRVj_82Q.png" /><figcaption>Flow of our AWS cloud function for monitoring IAP validation failures</figcaption></figure><p>In conclusion, analysing IAP transactions can be a worthwhile exercise for app developers because this can uncover hidden and potentially important patterns, instrumental in fixing issues or improving promotions. Python is an incredibly useful tool for Analytics of all shapes and sizes and particularly excels in analysis of time-series data like IAP transactions.</p><p>If you’d like to know more about this or want us to discuss a specific topic in our next Developer’s Blog, just leave a comment below!</p><p>Abhishek is the Data Analyst at Stick Sports. In his spare time, he enjoys watching TV on-demand, learning new things and sweating it out in the gym.</p><p>Have some pressing questions for Abhishek? <a href="https://t.me/sticksportsofficial">Join our Telegram group</a> and ask away!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2303b66016b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/stick-sports/in-app-purchase-analytics-with-python-b2303b66016b">In-App Purchase Analytics with Python</a> was originally published in <a href="https://medium.com/stick-sports">stick.sports</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>