Trying to connect Google Maps to dynamic page

Hi, I’m trying to create a directory of sorts using dynamic pages but I can’t connect data to the Google Maps element so it shows the same location for each page when I want it to change with the address. I looked at other forums and it seems like there’s a way to do this using code, but I’m not familiar enough with the terms to understand the instructions or where to place it. Can someone explain how to do this in a simpler way? Thank you.

You will need latitude and longitude for each location to do so, pulled from a collection, something like this:

let myLocation = $w("#googleMaps1").location;

 let txtGoogleMapsName = $w('#someDataSetName').getCurrentItem().title;
 let txtGoogleMapsLat = $w('#someDataSetName').getCurrentItem().latitude;
 let txtGoogleMapsLong = $w('#someDataSetName').getCurrentItem().longitude;

        $w("#googleMaps1").location = {
 "longitude": txtGoogleMapsLong,
 "latitude": txtGoogleMapsLat,
 "description": txtGoogleMapsName

This will put a tear drop on the lat/long coords with a name. Does that make sense?

Kind of? Are the only things that need to be edited the latitude and longitude and where would the code for this go and how would it display on the site?