Tracking Country Code

Hey guys, I’m wondering is there a way to track the country code / country group of the user filling out forms?? (this should be possible via IP tracking atleast right??)

Hey @vardy_ns :wave:

I love this question, because although Unbounce doesn’t currently have a way to track the city or country a visitor’s IP is from, Smart Traffic does quite a bit of the heavy lifting for you here.

One of the attributes that Smart Traffic learns from your traffic is location (IP address) – so in theory, if you’re creating content designed to appeal to certain regions, Smart Traffic will send your visitors to the variant that they’re most likely to convert on. I’m happy to elaborate more on that if you’d like.

Otherwise, if you’re comfortable with using a bit of custom code, you could write some javascript that does this (track city or country IP address). Or if you’re open to using another service, you could probably add some hidden fields to your form that pull the visitor’s IP city and country in to hidden fields and then map those fields over to HubSpot (for example) the same as any other field.

Let me know if you have any questions about this! Happy to chat more.


1 Like

Hi @vardy_ns,

As @Jess mentioned, recognizing countries out of the box is not currently supported in Unbounce but it’s pretty straight forward to achieve with a good API and a simple JS script.

Here is one for exactly that purpose - recording the lead’s country into a hidden country field.
However, keep in mind this was written over 4 years ago and the API service that it’s based on is no longer free.

It should give you a good starting point for writing a similar script that works for you and your particular case.