...
To be able to call this function, somewhere on the site {% include_plate_scripts "determine_location" %}
must be called (e.g. the head section).
Read more about include_plate_scripts
here.
The function returns a Javascript Promise, which you can use in the following way:
...