Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matthiasn/amzn-geo-lookup
Find user's local store for affiliate links by performing GeoIP lookup
https://github.com/matthiasn/amzn-geo-lookup
Last synced: 14 days ago
JSON representation
Find user's local store for affiliate links by performing GeoIP lookup
- Host: GitHub
- URL: https://github.com/matthiasn/amzn-geo-lookup
- Owner: matthiasn
- Created: 2014-02-22T21:07:10.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-24T11:15:56.000Z (about 10 years ago)
- Last Synced: 2024-05-02T04:02:05.515Z (7 months ago)
- Language: Scala
- Homepage: matthiasnehlsen.com
- Size: 289 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
amzn-geo-defragmenter
=====================Amazon has **[affiliate programs](https://affiliate-program.amazon.com/gp/associates/join/landing/main.html)** in multiple countries, each of which is separate from the others. For example, if you only send visitors of your page to the U.S. store but they are then redirected to their home store, you earn nothing. Thus, the affiliate links program works particularly well when most users come from the same country.
But what if your visitors come from all over the planet? This application can help! Instead of linking to a URL in a particular store, you create a shortened link with this tool and internally have a lookup table that maps this link to different store links depending on the country. Each time one of the shortened URLs is requested, this application will perform a local and superfast GeoIP lookup to determine the country of the requester. If a link for the country of the requester is found, that link will be delivered. Otherwise, users are sent to the U.S. store as a default.
From a technical perspective, this is what happens:
* Links are stored in a Scala Map inside the Play Framework application with different formats, e.g. with the key "slideshow1.narrow.DE"
* When a visitor comes to the page and requests "/slideshow1/narrow", a GeoIP lookup for the visitor's IP address will be performed
* If the Map contains the composite key, the user will be redirected to the appropriate URL
* Otherwise, the user will be redirected to a default URIThe (very fast) GeoIP lookup is performed locally by talking to an instance of **[freegeoip](https://github.com/fiorix/freegeoip)**. This allows for response times below 10ms.
## Licence
This software is licensed under the **Apache 2 license** as mentioned below.
Copyright © 2014 **[Matthias Nehlsen](http://www.matthiasnehlsen.com)**.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.