locked
Bing Custom Search JS Snippet not working in Facebook browser RRS feed

  • Question

  • Hi all,

    I've created a site and embedded the JS snippet for Bing Custom Search on multiple pages so that my visitors can run search queries and have the results returned to them on the page itself. 

    Snippet looks like this:

    <div class="mvmcustoms">
    <script type="text/javascript" id="bcs_js_snippet" src="https://ui.customsearch.ai/api/ux/rendering-js?customConfig=xxxxxxxxxx&amp;market=en-GB&amp;version=latest&amp;q=&amp;setLang=EN&amp;safeSearch=Moderate">
    </script>
    </div>

    This works well on all browsers tested (Chrome, IE, Edge, Firefox, Safari) but when running through the Facebook Web Browser (i.e. navigating to the site from our Facebook page and not opening in default browser on a mobile device), the search always returns the following alert:

    "Unable to execute your query. Ensure that a valid subscription key has been set up for your instance."

    I can't understand why it would be doing this. We had an issue with this alert on the site via normal browsers happening periodically before but it seemed to be due to the max transactions as we were previously on the Free pricing tier but have since upgraded and have not seen the same issue since, except always through the Facebook Browser.

    For reference, the site is https://maltavirtualmall.com/ and the Bing custom search text box is the one under the heading for "Search All Online Shops" on the homepage. Also note that i am using Wordpress as my CMS and the cos is inserted as HTML.

    I'm running under S1 pricing tier so the number of transactions should not be an issue as it is capped at 100 per second and i currently do not have enough simultaneous visitors to max this limit out.

    Any help with regards to this would be amazing!

    Thanks in advance :)

    Friday, May 29, 2020 8:24 AM

All replies

  • Hello mackoport,

    I have followed the steps to use facebook on a browser and search your online store but did not face any error. Is this an error that you are seeing at the back-end or on the search screen?

    I also tried to lookup the reference for custom search for facebook integration to check if any known issues are reported but there seems to be none. Is this a consistent behavior in this scenario?

    -Rohit

    Friday, May 29, 2020 1:08 PM
  • Hi Rohit,

    Thanks for your response.

    The issue exists when accessing the site directly from our Facebook page (https://www.facebook.com/maltavirtualmall) through the Facebook mobile app which then opens up the site home page in the Facebook in-app browser .

    There are 2 search boxes on the home page. The one relevant to this issue is the second box with the text "Search All Online Shops" above it.

    I have tested myself and have asked friends to test it on their mobile devices (Android and iOS) and they are all having the same issue.

    Friday, May 29, 2020 1:36 PM
  • Hello,

    Yes, I am able to view this error now directly from the facebook application. I am checking internally with our product team for their inputs on why this could be the case. 

    Meanwhile, is it possible to check if you can use couple of optional headers User-Agent & X-MSEdge-ClientID that are part of the custom search reference to check if this can help?

    -Rohit

    Friday, May 29, 2020 2:18 PM
  • Hi Rohit,

    Due to the way that i am implementing the search ( using Javascript snippet only), i am unable top include the headers you suggested as i am not making the API calls manually but instead through the Hosted UI via the javascript on my site. I hope that makes sense.

    Thanks for looking into this. Very much appreciated.

    Friday, May 29, 2020 2:48 PM
  • Hello,

    Based on initial analysis it looks like the requests from FB app or browser are stripping the headers.

    Could you please let us know if you have a valid support plan for your subscription to raise a support ticket to debug this issue with your team? If you do not have a valid support plan could you please email us your subscription id and URL of this thread to AzCommunity[at]microsoft[dot]com to enable a one time free support request for your subscription. We will let you know more details on how to use the request after we receive your email.

    -Rohit

    Friday, May 29, 2020 5:54 PM
  • Hi Rohit,

    Apologies for the late reply and thanks for getting back to me.

    I have basic support for Azure but was not able to get in touch with a support agent for assistance, hence my posting on this forum.

    I was able to find a work around for this using the Bing Custom Search plugin for Wordpress instead of injecting the JavaScript manually onto the pages i wanted search to appear.

    This seems to be working now.

    I will continue to look into this and will raise the request should i run into more issues while testing if that's OK as i would not want to waste your time if i am able to use this workaround.

    Thanks so much for your help with this. It is very much appreciated :)

    Monday, June 1, 2020 7:13 AM