Forum Academy Marketplace Showcase Pricing Features

Determine users country by ip

what’s the easiest way to determine users location by ip. For example in which country the user accesses the app.

2 Likes

What you can do is use the Current Position, and extract the country from it:

https://bubble.io/reference#Data.DataSources.PageData.Current Position

and

However, your users will have to be okay with sharing their location.

To use the IP, you can do this with Google Analytics, but it’s for analytics purposes, you won’t access it in the app.

1 Like

Sounds good. I will try it out and revert back with mor information

Thanks

Update for future reference…

Blockspring provides this
https://open.blockspring.com/search/blocks?q=ip

2 Likes

Ali, did you find a way to catch visitor’s IP adress?

Unfortunately from the initial tests that I did BS returns the IP address of the bubble server and not the users. It’s been a while I may have to give this another try. I need this feature to be able to record geolocation and IP for terms and conditions agreements.

What do need this for?

Is there any way we can determine the phone screen size of user i.e. browser type ?

I just wanted to grab the IP adress of those users who visited my web-site and then clicked on Request a quotation button. I thought getting user IP should be very simple in Bubble but it seems it’s not currently supported.

Well it’s not that straight forward. But for what you want (I guess statistics for who requested the quote) you can do with mixpanel or maybe zapier with Google sheets…

1 Like

I would imagine you will have the same issue with zapier, as it will be the server that calls the API not the client. Hence bubbles IP address

You would need something scripty on the front end (like Google analytics) to record it.

Been a while since coded them, but I wonder if you could drop something on a page to write a Google event.

@NigelG I know there is a way to pass dynamic data to HTML containers is there a way to retrieve output?

Back into Bubble ? Not sure about that, but I did wonder if you could embed a GA event on a bubble page.

Do you need to attribute this back to an actual transaction ? Or is this for analytics ?

Transaction wise

there is no way to retrieve output, that would be possible only through Blockspring

Yeah, but blockspring is being called from the server ?

Or is it … is it being called TWICE (as per the thread on random alphas) ? So are there really two IPs and can you get the “right” one ?

In fact I didn’t find such an option in Blockspring to simply catch the visitor’s IP. So i have followed Ali’s advise to use Mixpanel - it would show me which events happened broken down by the originating country.

3 Likes

Seems like the best way for now.

Hello @emmanuel

Can you support this topic by adding the code incorporated in the below url to determine user IP. The problem with the BlockSpring Block is that it always retrieves the server’s IP and not the user. But placing the below call retrieves the users IP that can be later used in conjunction with blockspring by adding it under IP Address. (This is a BB Block)

https://www.ipify.org/ - Free API available Here
Give it a try here https://api.ipify.org/ (No key requried)

i believe this will add value to the community as it is required to meet some legal aspects when users accept terms and conditions of the website. Also it can be used to determine time zones, or automatically redirect users to specific pages based on country

Would love for this to be incorporated in the core of Bubble so it can be used easily as dynamic data like other options e.g. Current location so it can be used in workflows…

Another subrequest is to determine timezone by extract of using the current date/time

3 Likes

I just added it (and also added a plugin to show the compliant cookie message for sites in the EU).

See the new plugins:

  • Cookie consent (EU)
  • ipify
1 Like

@emmanuel thanks for great support

1 Like