How to save User's country code in Bubble Part 1

In this tutorial video we demonstrate how to use the IP Geolocation plugin by Zeroqode to save a user's country code to the database in the correct format to use with the Page2API web scraper.

Still stuck?

Schedule a free 1 to 1 Bubble coaching Zoom call.
Learn more
Bubble coaching learn no-code

In this tutorial, I'm going to show you how to take your user's IP address and generate a country code for the location of the IP address, and then save that into your Bubble app.

IP Geolocation plugin

So we need a plugin to do that. And I've got this plugin here, IP Geolocation by Zeroqode. And to get the data from it, I need to add the element to my page.

So you can test that it's working I had a text box and then I just refer to the element and I can get all these different pieces of information. I'm going for country code because this is part of a two video series showing how to insert a country code into the Page2API so that you can web scrape from the perspective of another country, like viewing the website that you're scraping content from, as if you're viewing them from basically any country around the world. So I'm going to take the country code because that's a two digit representation of the country.

And then if I click here, I just need to change this to IP. No, it's one of these fields. If I look at the documentation, it says response. IP. Geolocation. But I think they've updated their plugin.

Where is it? Okay, I just checked and the fields I need to use is text. So if I click preview, there we go. I am in the UK or Great Britain as a country code it gives back GB.

Saving country code to database

Now, how do I save that into my database? So I'm just going to add a button in and this could be part of like an onboarding workflow. So assuming that I've already registered the user, I can go account, make changes to current user, change another field, and then I can add in country code and it's just text. And then I refer to the item. Remember, the text on the page is just so I can check that it's working.

Changing case of country code

So I can refer back to the plug in element that I added to the page country code. And I know looking at the page two API documentation like here, that it expects the country code values to be lowercase. So I'll just go more and then lower case.

So by clicking this button, I'm saving that two digit country code in lowercase to my Current User. I'm now going to stop this video, and I'll be recording right away a video showing how to input this into the API Connector workflow for Page2API.

Notify of
Inline Feedbacks
View all comments