1

I develop some premium apps that users can download directly from my landing pages, so the installs aren't going through play store.

The apps communicate with my server for tracking purposes, and I would like to be able to pinpoint which app installs correspond with which download entries in my downloads tracking system, to be able to accurately analyze my campaigns.

Is there a way in which I can identify the user or device in relation to the APK download?

Edit:

What I've tried so far is to create a fingerprint using data such as IP, country, browser user agent and android version, save it in the database, and have the app send me the same data after it's first opened, then try to find an entry like that, but it fails more often than not (can't find a corresponding entry).

I can't post that part of code, due to company policy (Yeah, I know...) -_-

As some extra info, my pages are using php in the backend. I've been trying to create some kind of fingerprint of the user device and compare it after the app is installed and opened with the fingerprint database on my server, but it's not a good system...

J.C. Vara
  • 13
  • 4

1 Answers1

0

One way is to use a custom product flavor for the version that can be downloaded on your website. If you use the buildConfigField property in Gradle you can have the app automatically send a custom tracking property to your tracking server.

build.gradle:

productFlavors {
    GooglePlay {
      buildConfigField 'Boolean', 'isGooglePlay', 'true'
    }
    Website {
      buildConfigField 'Boolean', 'isGooglePlay', 'false'
    }
}

Analytic.java:

private String appendTrackerToQueryString(String queryString) {
    return queryString + "&productFlavor=" + (BuildConfig.isGooglePlay ? "GooglePlay" : "Website");
}

Edit based on clarifying information about question:

Since the op is wanting to tie specific downloads with specific installations, an alternative approach is to create a configuration file dynamically and inject it into a prebuilt apk file using aapt. See Android: How to manually add a file to apk?. The new package would need to be resigned using the same keystore, then made available to download by the user. This approach adds some time to the download process, so it would need to be balanced with server load and download demand.

Community
  • 1
  • 1
Chris
  • 1,180
  • 1
  • 9
  • 17
  • Sorry, I think I haven't explained myself well... My app is not on Play Store at all, and I'm not trying to track the origin of the install, but trying to link the tracking of the APK downloads with the installs, identifying which install corresponds to which download... – J.C. Vara Jan 26 '16 at 15:12
  • Ah - well that will be tough to know for sure. You could try to estimate it using an approach like you have described, but it's unlikely to be foolproof as you have found. One option is to do something like I've described, but instead creating a dynamic build at the time of download. Essentially, you will have an apk ready to go, then use aapt to inject a file into the build containing the dynamic configuration and then resign the package using jartool or similar. Not sure how long the process would take but should be a lot quicker than doing a complete build on demand. – Chris Jan 26 '16 at 15:24
  • That sounds pretty interesting, actually. I sure wonder how it could affect the server load, but I'll be sure to investigate this idea further... I'll wait for a couple days to see if there's any other answer, but you should edit your answer with this idea too, and I'll accept it unless there's a better answer :) – J.C. Vara Jan 26 '16 at 15:28