displaying a message or banner for specific customers on website

Solved

displaying a message or banner for specific customers on website

BM136
Excursionist
42 0 8

Hi,

 

Is their a way to display a message or a banner in header of the storefront based on customer location?

 

example: if visitor located in UK, display a special message or a banner at header (something for shipping)

 

Thanks in advance

Accepted Solution (1)
LitExtension
Shopify Partner
4915 1005 1183

This is an accepted solution.

Hi @BM136,

You can contact ipregistry directly for further assistance: https://ipregistry.co/

Because I used their API and everything works fine. It will be the best way if you don't install the app.

If it helped you solve your issue, please mark it as a solution. Thank you and good luck.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com

View solution in original post

Replies 4 (4)

LitExtension
Shopify Partner
4915 1005 1183

Hi @BM136,

Please go to header.liquid file and add code:

<div class="header-message" id="MessageCountry">
    </div>
    <script>
      fetch('https://api.ipregistry.co/?key=tryout')
      .then(function (response) {
        return response.json();
      })
      .then(function (payload) {
        switch(payload.location.country.code) {
          case 'UK':
            document.getElementById('MessageCountry').innerHTML = 'Message';
            break;
          case 'FR':
            document.getElementById('MessageCountry').innerHTML = 'Message';
            break;
          default:
            document.getElementById('MessageCountry').innerHTML = 'Message';
        }
      });
    </script>

You can display Message with text or html you want.

Hope it helps!

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com
BM136
Excursionist
42 0 8

Hi,

 

Thanks, it is useful. but it works for about 2 times only then stop working

LitExtension
Shopify Partner
4915 1005 1183

This is an accepted solution.

Hi @BM136,

You can contact ipregistry directly for further assistance: https://ipregistry.co/

Because I used their API and everything works fine. It will be the best way if you don't install the app.

If it helped you solve your issue, please mark it as a solution. Thank you and good luck.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com

Dirk
Shopify Staff
2428 258 551

Hey. @BM136 Great question. 

 

I have actually only heard of one app that allows you to personalize your homepage and the content it displays depending on the visitor that is viewing your storefront. The app is called DataCue. They offer a 14-day free trial and then plans start at $9.99/month.

Note: I do not have experience using this app so I can't speak to how it functions. However, they do have a handful of reviews on their page that you can always check out. 

Dirk | Social Care @ 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