-2

Is it possible to have a script in Squarespace header/footer that works for directing users from a specific country to a specific URL?

SourceS
  • 59
  • 1
  • 8

1 Answers1

1

Yes, It is possible.

You can forget about adding a custom server side script, as Squarespace doesn't allow that. reference: https://support.squarespace.com/hc/en-us/articles/205815358-Custom-code-FAQ

One option is to use a plugin.

One way to do it isto use a plugin You can do this easily via a plugin called Geo Targetly : https://geotargetly.com/squarespace-geo-redirect

Second option is to use JavaScript code:

First, you need to identify the location of the user, answered here: How to detect browser country in client site?

Second, use the below script to change the user URL:

<script>
function myFunction() {
  location.replace("https://www.MySite.CA")
}
</script>
Djenane
  • 29
  • 3
  • Should this work? ` ` – SourceS Jun 23 '20 at 18:28