diff --git a/apps/docs/editor/blocks/logic/set-variable.mdx b/apps/docs/editor/blocks/logic/set-variable.mdx index c1082a67a..4b43ae60f 100644 --- a/apps/docs/editor/blocks/logic/set-variable.mdx +++ b/apps/docs/editor/blocks/logic/set-variable.mdx @@ -121,3 +121,23 @@ This value block allows you to find the `Id` from `Ids` with the same index as ` alt="Set variable map item with same index" /> + +## Get user's geo location + +For this you can provide the following custom code: + +```js +function getPosition() { + return new Promise((resolve, reject) => { + navigator.geolocation.getCurrentPosition( + (position) => resolve(position), + (error) => reject(error), + { enableHighAccuracy: true, timeout: 5000 } + ) + }) +} + +const coords = (await getPosition()).coords + +return `${coords.latitude}, ${coords.longitude}` +```