I had a client at one point who wanted a way to directly attribute installs without the use of any “external services”.
I created a simple PHP & MySQL setup for them. They created custom links, such as example.domain/attribute.php?source=facebookCampaign21, which directed clients to a simple PHP file that logged the user’s IP address, the source (i.e. link clicked) and timestamped it. The entry would remain in the database until it was claimed or it timed out. Once the PHP file would be done with the user, it would redirect the user to the correct app store page (i.e. pretty much instantly).
Whenever a user started the app for the first time, the app connected to the same database and the PHP file checked if the user’s IP existed there. If the connection failed, it would try it again later. If the IP was found, then the entry was claimed and a new entry with the necessary information was added to another database with info such as when it was claimed, source, etc.
This is a pretty simple method for general attribution and if you already have a server and a domain, then it’d cost you only the hours you’d put into programming it.
Edit: I edited the paragraph below because I completely forgot to mention how to address the limitation concerning IP addresses.
Its one weakness is, however, that IP addresses can change and there may be several users behind the same IP due to them being on the same network or behind a proxy. If you were to use JavaScript instead of PHP, then you can use device fingerprinting to further identify different devices. You can obtain things like user agent, screen resolution and its colour depth, font list, timezone and whatnot. So, this wouldn’t 100% guarantee that every user is unique, but it gets pretty damn close.
Still, it’s a pretty elegant solution in my opinion. I have been meaning to turn it into a plugin and a service, but I’ve been preoccupied with other projects, such as a story plugin that I’m working on atm.