0

We use Drupal 7 webform module. We want to detect the sender's Country automatically from the IP Address. Then based on the Country, the form is sent to another e-mail address. We do not want an extra location checkbox, as not to harm the conversion rate.

So for example: If the person is located in the US then send form submission to us@company.eu.

Is this possible?

0

You could take a look at the ip2country module, which saves the country on the $user object based on the user's current IP address.

From the description of the module:

This module uses a visitor's IP address to identify the geographical location (country) of the user. The module makes this determination and stores the result as an ISO 3166 2-character country code in the Drupal $user object, but otherwise has no effect on the operation of your site.

  • I need only the country. This ip2country module can work but puts a heavy load on the database and uses extensive calculations for each webform submission. I wanted to use a webform hook, and use an external service like ipdata.co/index.html to get the country. I would like your ideas about this. – Summer Jul 16 at 17:33
  • I somehow think that it dosen't matter which solution you use. Both of them require you to read from an external database, which may sometimes be fast and sometimes be slow. So unless you know that one of the sources tend to be slow I don't really think it matters. Also the ip2country module seems to be used by many sites and is also covered by drupal's security policy, so I think it should be fine. Thanks :) – Jdrupal Jul 16 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.