Displaying custom announcement text based on visitor's IP Address

michal1
New Member
3 0 0

Hi 

i would like to set an announcement text in a header that would tell my customers that we ship to their country - based on their ip

i found the discussion that is talking about this but i have no idea how to implement this to a header announcement

Could you help me with this please ?

Thanks!

Replies 4 (4)
Zuzanna
Shopify Staff
Shopify Staff
97 1 27

Hey Michal, 

I'm Zuzanna, from the team here at Shopify 🙂

The best way to do that would be through an app. Apps are like extra features for your store, and in this case an app like Quick Announcement Bar by Hextom will be your best bet! They allow you to easily create an announcement bar and although you can't base it on a customers IP, it does give you the option to geo target customers and set the announcement bars to only display to visitors from selected countries. Give it a try! 

I hope this helps! If you have any more questions or concerns feel free to reach out to us here 🙂 

Have a great one,
Zuzanna

Zuzanna | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

michal1
New Member
3 0 0

thank you very much for a help but unfortunatelly this feature requires pro version with monthly fees. 

michal1
New Member
3 0 0

As my skills are very limited, i struggled to make it work but i finally did it thanks to the old discussion linked above

you have to place this script before body tag at the end of your theme.liquid

<script>// <![CDATA[
jQuery.ajax({
  url: '//freegeoip.net/json/',
  type: 'POST',
  dataType: 'jsonp',
  success: function (location) {
  jQuery('#country-name').html(location.country_name);
  }
});
// ]]></script>

then you can use this to show custom text with visitors country name

<p>Yes, we ship to <span id="country-name"></span></p>

i have edited the text with yellow background because that is best i can do and i put it in header right bellow my logo as this

<p style="text-align: center;"><span style="font-size:18px;"><span style="font-family:arial,helvetica,sans-serif;"><strong><span style="background-color:#F3F781;">Free Shipping To <span id="country-name"></span></span></strong></span></span></p>


it doesnt look that great but it was best i could do

MichaelGeo
Pathfinder
194 3 16

Hi there!

 

You could check Geo Targetly solutions. It can easily access your website visitors' locations, like country/state/city using their IPs.

 

Its particular Geo Bars can help set up location-specific messages, its placement on your webpage, which can be dynamically altered based on your visitors locations.  It's easy to set up within only a few steps. No coding is necessary by yourself.  Shopify platform is perfectly supported.

 

You could also check its Geo Content tool, if you want to set more location-based content on your website, like headings, banners, contact information, etc, 

 

Hope it helps! Please feel free to reach out if you have any questions.