Boost Posted November 17, 2023 Share Posted November 17, 2023 Hi, I'm a bit confused about where and how the geo-targeting should occur. For instance, I have page A with a button that will link to either page B (if you are in the US) or page C (if you are in the UK). My concern is how to ensure that the link points to the right page. I'm not worried about the geo-targeting code; I have that covered. My uncertainty lies in how to dynamically assign the correct link to the button. The challenge is that I'm using the TinyMCE editor for the copy, which includes the button. Is there a way to route the link through a hook or function that will determine the geo-targeting? Please feel free to ask any additional questions if my explanation is unclear. Thanks! Link to comment Share on other sites More sharing options...
Boost Posted November 18, 2023 Author Share Posted November 18, 2023 I just used hanna code. <?php namespace ProcessWire; $country = getLocation(); // my geo-targeting function that returns the country iso two letter code $creditUnion = "/solutions/credit-unions/"; $buildingSociety = "/solutions/building-societies/"; $pageLink = $country == 'GB' ? $buildingSociety : $creditUnion; echo "<a class='uk-button uk-button-orange uk-border-pill uk-text-bold' href='" . $pageLink . "'>Learn More</a>"; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now