Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--
- PLEASE NOTE:
- This sameple DOES NOT include the standard liveperson tag which should already be included on all pages you wish to start,
- continue cobrowse live sharing on
- -->
- <a href="#" onclick="enterServiceNumber();">Start Voice to CoBrowse Session</a>
- <script type='text/javascript'>
- function requestCobrowse(serviceId) {
- lpTag.taglets.cobrowse.loadApi(function (visitorApi) {
- console.log("CoBrowse visitor API loaded");
- visitorApi.once("sessionRejected", function () {
- alert("The service number is invalid.");
- });
- visitorApi.once("sessionOffered", function (event) {
- console.log("Agent answered the request and offers a CoBrowse session");
- var automaticallyAcceptOffer = true; // Set to false if you would like to ask the visitor to confirm the session start.
- if (automaticallyAcceptOffer || confirm("Would you like to start a CoBrowse session with '" + event.agentAlias + "'?")) {
- visitorApi.acceptSupportOffer(event);
- } else {
- visitorApi.cancelSupportOffer(event);
- }
- });
- function sessionReadyCallback(startEvent) {
- if (startEvent) {
- console.log("Session is ready and will be started shortly.");
- }
- }
- visitorApi.requestSupport({
- serviceId: serviceId
- }, sessionReadyCallback);
- });
- }
- /**
- * Example: Display a simple dialog for entering the service number. In non proof-of-concept
- * deployments the prompt should be replaced with a dialog that reflects the CI of the brand.
- */
- function enterServiceNumber() {
- var serviceId = prompt("Please enter the CoBrowse service number in the field below.");
- if (serviceId) {
- requestCobrowse(serviceId);
- }
- }
- </script>
Add Comment
Please, Sign In to add comment