Issue with AjaxRequest in syndicated ConditionalChatLink

Tags: 

Syndicated ConditionalChatLink has been implemented on the external page. The link appears for the first time when the page loads. When the user navigates between the tabs (or even when a refresh is done), the link does not appear. The code for conditional chat link is written in the template file of Front end page and re-loads on every refresh or tabs navigation.

The user open the external webpage. After the initial load of the page, the chat link appears. Navigate to another tab and return back to the same tab. The chat link does not appear now.

I was checking the all request made from the Front end page to RightNow server and found that RightNowClient.js file is being loaded and ajaxRequestOptional is also being made during initial load but afterwards the RightNowClient.js gets loaded but NO ajaxRequestOptional are made.

Therefore I am assuming no Chat Links is being displayed. What can be the reason for intermittent behavior of AjaxRequets.

Comments

With the Proactive Chat syndicated widget, the framework will set a cookie named "noChat" once a proactive chat has been offered. Once that cookie is set, the Proactive chat widget will stop working until the cookie is removed (or expires).

I wonder if the Syndicated Conditional Chat link behaves the same way. When you run your test case as described above, do you see a cookie set named "noChat"?

I checked for the noChat cookie. It does not have any issue with that cookie. Even when it is set, the syndicated chat is appearing sometimes, but it is still not consistent. If I reload, the status appears (with the cookie set).

A couple other things to check that trip me up with Proactive Chat (similar to Conditional Chat).

1. Make sure that an agent is logged into the console and signed into Chat (and Active)
2. Make sure that the chat routing rules are appropriately routing the user to the correct chat queue (where an agent is available)
3. Make sure that you are testing within the configured chat hours
4. Check your "Conditions". The whole point of the widget is that the link will only appear if certain conditions are met (such as queue wait time or agents available). Make sure that those conditions are being met.

Can you throw your widget initialization code in JSFiddle and share?
Similar to this: http://jsfiddle.net/fishnugget77/gcns7/
If you can make it work in JSFiddle, the problem may be with other JavaScript code on your page.

Hi Andy,

Thanks for the response. The Proactive Chat is working fine. The issue is with Conditional Chat not appearing consistently. I checked the above cond for Conditional Chat as well and its fine. But I am thinking if it displays on reload of the web page, then these conditions should be satisfied. It looks to be a race between web page and the widget loading and there is some issue. I am really out of ideas.

Can you share your initialization code? Post it on JSFiddle or somewhere?

are you looking for the conditional chat link code? I can paste that here.

Yes

Yes, the code you are using to initialize the syndicated widget. You can omit the site URL portion if you need to, or replace it with //cx.rightnow.com/ci/ws/get


<script type="text/javascript" src="//.widget.custhelp.com/euf/rightnow/RightNow.Client.js"></script>

<script type="text/javascript">
RightNow.Client.Controller.addComponent(
{
p:"7",
c:"13",
custom_fields: "{\"2\":\"FD\", \"3\":\"service\", \"5\":\"Residence\"}",
container_element_id: "myChatLinkContainer",
info_element_id: "myChatLinkInfo",
link_element_id: "myChatLink",
instance_id: "sccl_0",
module: "ConditionalChatLink",
open_in_new_window:"false",
wait_threshold: 40,
ignore_preroute: false,
min_sessions_avail: 0,
enable_availability_check: true,
enable_polling: true,
label_default: "Chat directly with a member of our support team.",
type: 7
},
"//<site>.widget.custhelp.com/ci/ws/get"
);
</script>

<div id="myChatLinkContainer">
<div id="myChatLink">
<div id="myChatLinkInfo">
</div>
</div>
</div>

Your initialization code looks fine.

You mention tab navigation. Are you doing page refreshes or AJAX/Dynamic HTML?

If you are doing anything besides page refreshes, this is probably your problem. The widget initialization code relies on the DOM Ready event that occurs at the end of a page load.

If you want to have the widget re-check the server for availability status in a dynamic fashion, you will need to do some additional javascript. I've built an example for you in JSFiddle:
http://jsfiddle.net/fishnugget77/gcns7/

Note: i also disabled polling. You probably don't want this, but keeping it set to true won't hurt much.

The javascript is code in the template file which re-loads everytime I navigate to the other tab, so i am assuming that it should be a page refresh. Is that okay or I need to add the new lines of code
Can I use the //Widget loaded callback code as it is after the conditional chat code? How will the refreshChat function be called?

Hi Andy

Thanks for the input. I am hoping it will work once I add this script on the external web page.

I had one more query. I was reading through some post where in it says Syndicated Widget cannot configured. I am not exactly looking to configure. My requirement is, Can I have control on the parameters that is being passed to call the syndicated widget. The reason being I want as less dependency on the external web page team and control it from the RightNow side.
In order to achieve this I was planning to copy the existing syndicated conditional chat widget and change the info.yml file as required, but as I read the post, it says I can extend the functionality of conditional chat but NOT for syndicated conditional chat.
Is there any workaround for my requirement? Any suggestion would be appreciated.

Thanks in advance.

Hi Manish,
You can put all of your initialization JS into an external exclude file that you control. A good place to host this would be in the assets directory of your Customer Portal pages. You would then have your web team include two scripts on their page. 1) the RightNow.Client.js file and 2) your include that contains the initialization code

Thanks a lot Andy. That was one of the easiest solution one can thikn of to control the attributes of a syndicated widget. I have been banging my head on this. Also on RightNow support portal, I was told that its not possible.

I still need to test on the earlier issue. Still waiting on my web team. This was the reason I had the second query :)

Hi Andy,

The issue exists even after placing the code that you provided. The chat link is still appearing intermittently.
Any other thoughts that I can try?

Do you see the same behavior if you add your includes to a bare bones page or build it on a JS test service. For example, you could do the test using jsfiddle.net or plnkr.co

Isolating the chat code will help to determine if the problem lies in chat, or if there is a conflict with JS code on your webpage. Also, if you can share the test (something that jsfiddle.net or plnkr.co can do), I can see if I can reproduce your issue and debug it further

AR

Zircon - This is a contributing Drupal Theme
Design by WeebPal.