Using URL parameters to interact with Google Maps API


#1

I successfully passed my URL parameters from one page to another using a form. My URL on the second page has one URL parameter and looks now like this:

http://www.agentmakers.com/home-worth-demo-2/?street_address=2117+agincourt+ann+arbor+mi+48103

I would like to use the “street_address” value to generate a different Google Map everytime on the second page…

I have used custom html to iframe a google map onto the second page. The iframe code looks like this:

<iframe width="600" height="450" src="https://www.google.com/maps/embed/v1/place?key=MY_API_KEY&q=2117+agincourt+ann+arbor+mi+48103"></iframe>

Is there a simple javascript code to use on the second page that will insert the “street_address” parameter into the “q” value in the iframe source?

Do I need one script to pull out the URL parameter, and another script to replace the value?

I’m lost. Please help.


Using An Address To Display A Custom Embedded Google Map
#2

Hi

Did you get an answer to this? I’m looking to do something similiar

Thank you


#3

Bump. Any way of inserting dynamic text into custom html?

Thanks community :slight_smile:


#4

Come on Community! This is similar to the existing function to add a dynamic video url. Someone more clever than I must be able to propose an answer? Unbounce team?

Thanks


#5

Hi @Carl_Duncker,

If you provide a bit more details on exactly what you are trying to accomplish you might be able to get an answer.

However, based on your previous posts, it looks like you might need a custom script specifically developed for your particular use case.

Best,
Hristian


#6

Thank you

Looking to follow exactly the same concept as [How-to] Dynamically Swap an Embedded Video with URL Parameters but, Google maps rather than YouTube video to dynamically change

src=“https://www.google.com/maps/embed/v1/place?q=34%20Watson%20Cres%2C%20Edinburgh%20EH11%201HF&key=AIzaSyD_dxO2wrBGplw53sE6CvggZ_YLg-NCPew

The concept appears similar so I’m hoping someone technical can take it and amend. Would be a great addition for Unbounce as we have 250 locations I’m wanting to create one dynamic landing page for.

Thank you


#7

Any ideas @Hristian?

Thanks


#8

Hi @Carl_Duncker,

Technically it should be possible to accomplish this with a custom script.

However, the only way to be sure is to actually write the script and do some more in-depth testing.

Best,
Hristian