Skip to content
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

Open
mpowney opened this issue Apr 14, 2020 · 1 comment
Open

Add country of origin to click count #31

mpowney opened this issue Apr 14, 2020 · 1 comment
Labels
enhancement New feature or request feature-request

Comments

@mpowney
Copy link

mpowney commented Apr 14, 2020

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:
Screenshot of polr UI

I’d love to help implement this if it’s suitable / you have any thoughts?

┆Issue is synchronized with this Trello card by Unito

@FBoucher FBoucher added enhancement New feature or request feature-request labels Apr 17, 2020
@mreyeros
Copy link

mreyeros commented Oct 15, 2020

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.

mreyeros added a commit to mreyeros/AzUrlShortener that referenced this issue Oct 17, 2020
- adding ip location support
- code refactoring/cleanup
mreyeros added a commit to mreyeros/AzUrlShortener that referenced this issue Oct 19, 2020
…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
@sync-by-unito sync-by-unito bot closed this as completed Dec 10, 2022
@FBoucher FBoucher reopened this Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature-request
Projects
None yet
Development

No branches or pull requests

3 participants