-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add country of origin to click count #31
Comments
I found the following free "API" that can possibly be called from within the UrlRedirect function to capture the country code/country name based on the IP of the link consumer. It does have a limit of 15000 calls per hour, not too bad for being free. There are other alternative services/apis available that provide this functionality, but that would probably require prior setup of an API Key for one of those services to be added as part of the deployment. This in turn would probably require secure storage of said API Key in a secure store like Azure KeyVault. Additionally, I think that the ShortUrlEntity would need to be enhanced to store the additional details around country and click counts. I am thinking perhaps a Dictionary<string, int> would probably serve as a decent mechanism for capturing the click counts by country. |
- adding ip location support - code refactoring/cleanup
…factoring - Introduced Blazored.FluentValidation for handling Validation of ShortUrlEntity on Edits or Adds - Introduced IStorageTableHelper to inject StorageTableHelper via Dependency Injection for all Azure Functions removing code duplication - Modified ShortUrlEntity Clicks definition from int to Dictionary<string, int> to store click counts by country - Intriduced some helpers and extensions methods to reduce code duplication - Introduced EntityJsonPropertyConverter to handle serialization/deserialization of ShortUrlEntity Clicks property - Introduced UserIpLocationService to call the https://freegeoip.app/ service for obtaining user click data (i.e. country of origin) - Updated all azure functions to inject IStorageTableHelper to reduce code duplication and coupling to StorageTableHelper implementation
Other open source URL shorteners like Polr (PHP based) have a country of origin option when viewing number of clicks.
This might add too much complexity to such a lightweight implementation, but worth considering? Looking at polr’s implementation, you’d need a db of IP ranges to match to the countries, or a free service to look this up, plus storing the data needs to comply with GDPR (ie. not persist the storage or source IP addresses, just the country and click count).
Here's a screenshot of the UI in Polr:
I’d love to help implement this if it’s suitable / you have any thoughts?
┆Issue is synchronized with this Trello card by Unito
The text was updated successfully, but these errors were encountered: