How to install widget only for mobile website version

If you want to install the widget only for mobile version of your website, you need to replace the platform script (the 1st line of the code) in your widget installation code with this script:

<script>
if (window.innerWidth < 440) {
  const elfPlatform = document.createElement("script");
  elfPlatform.src = "https://static.elfsight.com/platform/platform.js";
  elfPlatform.defer = true;
  elfPlatform.setAttribute('data-use-service-core', "");
  document.head.append(elfPlatform);
}
</script>

Here is an example of how the full installation code will look:
<script>
if (window.innerWidth < 440) {
  const elfPlatform = document.createElement("script");
  elfPlatform.src = "https://static.elfsight.com/platform/platform.js";
  elfPlatform.defer = true;
  elfPlatform.setAttribute('data-use-service-core', "");
  document.head.append(elfPlatform);
}
</script>
<div class="elfsight-app-46e572bc-ad98-4609-8ec7-3af76855bfd4" data-elfsight-app-lazy></div>

Got questions or faced issues? Describe your use case in the comments and we’ll be happy to help :slightly_smiling_face:

When I put the templates in this on my website, the template can be seen on a desktop PC, but the template cannot be seen on the mobile phone. How to fix it? If this doesn’t show on mobile, then taking the template from this is useless. Please add these feature to templates.

Welcome to the Community @s_s :wave:

Could you please share a direct link to the page where your widget is installed? I’ll be happy to check it for you :slightly_smiling_face:

When I put the templates in on my website, the template can be seen on a desktop PC, but the template cannot be seen on a mobile phone. How to fix it? (I only copy code from the template and paste it into an HTML file.)

Could you please send a link to your webpage where this issue occurs?

Are you checking it? It will be a big help if you fix this

1 Like

https://betterlinkelectronic.000webhostapp.com/ Template: Google review widget

I’ve checked your website and the widget is displayed both on desktop and mobile.

If I understood you correctly, you’d like to display your Google Reviews widget only for mobile devices.

I see that you’ve tried to use the code from this thread, but you’ve added to the wrong place. You need to replace the first line of the installation code with this script:

<script>
if (window.innerWidth < 440) {
  const elfPlatform = document.createElement("script");
  elfPlatform.src = "https://static.elfsight.com/platform/platform.js";
  elfPlatform.defer = true;
  elfPlatform.setAttribute('data-use-service-core', "");
  document.head.append(elfPlatform);
}
</script>

Please check it out and let me know if it helped :slightly_smiling_face:

Thanks, man! After a long time, this is now showing me on my real mobile device, so far it was only showing me in the Developer mobile view. Thank you very much for your help. I really appreciate it.:+1:

You are always welcome :wink:

We’d really appreciate it if you could check out the Google Reviews category in the Wishlist and vote your favorite ideas. It would be incredibly helpful for the development of our widgets and services.

And of course, feel free to share your own ideas – we’d love to discuss them with you!