Difference between revisions of "WID/Current/Developer/GWCDeployment"

From Genesys Documentation
Jump to: navigation, search
(Published)
(Published)
Line 1: Line 1:
 
{{Article
 
{{Article
 
|Standalone=No
 
|Standalone=No
|DisplayName=Get started with Genesys Widgets
+
|DisplayName=Genesys Widgets Deployment Guide
 
|Platform=PureEngage
 
|Platform=PureEngage
|TocName=Get started
+
|TocName=Genesys Widgets Deployment Guide
 
|ComingSoon=No
 
|ComingSoon=No
|Context=Here's how to instrument your website with Genesys Widgets.
+
|Context=This guide provides the steps required to instrument your website with Genesys Widgets.
 
|Section={{Section
 
|Section={{Section
|Type=Structured
 
|alignment=Vertical
 
|gif=No
 
|structuredtext=Use Genesys Widgets to add {{Link-SomewhereInThisVersion|manual=SDK|topic=WebChat-combined|display text=chat}}, {{Link-SomewhereInThisVersion|manual=SDK|topic=Callback-combined|display text=callback}}, or {{Link-SomewhereInThisVersion|manual=SDK|topic=Co-browse-combined|display text=Co-browse}} to your website, whether you use human agents alone or enhance their capabilities with Genesys chatbots or voicebots. These lightweight widgets provide either passive or predictive customer support—or both. All Genesys products currently support WebChat, while most support callback and Co-browse—but these are only the first available widgets that you can add to your website. Genesys will provide new types of widgets in future releases.
 
 
[[File:CXWChatWidget_082017.png]]
 
 
Genesys Widgets provide:
 
 
*Multi-language support
 
*Easy setup and {{Link-SomewhereInThisVersion|manual=Developer|topic=GWCConfig|display text=configuration}}
 
 
You can also use the {{Link-SomewhereInThisVersion|manual=SDK|topic=GWCBusAPIOverview|display text=Widget Bus API}} to integrate Genesys Widgets with your own scripts, whether by invoking widget commands or receiving widget events. For example, you can launch widgets from your own scripts, or execute custom code when a widget is closed.
 
 
'''Note:''' Genesys Widgets require {{Link-SomewhereInThisVersion|manual=Developer|topic=GWCCookies|display text=cookies}} to function, whether for saving UI state or for maintaining an active session with an agent as users navigate your website.
 
 
*{{Link-SomewhereInThisVersion|manual=SDK|display text=Widgets API Reference}}
 
|fullwidth=No
 
|Status=No
 
}}{{Section
 
 
|sectionHeading=Audience
 
|sectionHeading=Audience
 
|Type=Structured
 
|Type=Structured
 +
|anchor=Audience
 
|alignment=Vertical
 
|alignment=Vertical
 
|gif=No
 
|gif=No
Line 37: Line 18:
 
|sectionHeading=Cookies
 
|sectionHeading=Cookies
 
|Type=Structured
 
|Type=Structured
 +
|anchor=Cookies
 
|alignment=Vertical
 
|alignment=Vertical
 
|gif=No
 
|gif=No
|structuredtext=Genesys Widgets uses {{Link-SomewhereInThisVersion|manual=Developer|topic=GWCCookies|display text=cookies}} to store non-sensitive data in the browser. These cookies are used to restore a chat session, to track the state of the UI, to store a user's decision, and more. The end-user's browser must allow cookies for Genesys Widgets to operate properly.  
+
|structuredtext=Genesys Widgets uses cookies to store non-sensitive data in the browser. These cookies are used to restore a chat session, to track the state of the UI, to store a user's decision, and more. The end-user's browser must allow cookies for Genesys Widgets to operate properly.  
 +
 
 +
{{NoteFormat|No personally identifiable information (PII) is ever stored in cookies, local storage, or session storage by Genesys Widgets.|}}
  
{{NoteFormat|No personally identifiable information (PII) is ever stored in cookies, local storage, or session storage by Genesys Widgets}}
 
 
===Sub-domains===
 
===Sub-domains===
Cookies can't normally be transferred between the subdomains of a website unless they are configured to do so. Genesys Widgets automatically detects the domain of the host site and configures all cookies so they can be transferred between subdomains. For example, you could start a chat on '''www.testsite.com''' and restore that chat session on '''store.testsite.com''', '''support.testsite.com''', or '''portal.testsite.com'''.
+
 
 +
Normally, cookies can not be transferred between sub-domains of a website unless they are configured to do so. Genesys Widgets automatically detects the domain of the host site and configures all cookies to be transferable between sub-domains. For example, you could start a chat on '''www.testsite.com''' and restore that chat session on '''store.testsite.com''', '''support.testsite.com''', or '''portal.testsite.com'''.  
 +
 
 
===Cookie support in test environments===
 
===Cookie support in test environments===
Genesys Widgets uses special cookies that persist across subdomains. This is a critical feature for plugins like WebChat that need to restore an active chat session while navigating around a website. The side effect of using this type of cookie is they won't work when using test environment domain names such as "localhost" or an IP address. You must use a fully-qualified domain name (FQDN) such as "localhost.com" or any other variant that can be identified as a domain name. Cookies will also fail to work if you run the test site as an HTML file path directly in the browser.  
+
 
 +
Genesys Widgets uses special cookies that persist across sub-domains. This is a critical feature for plugins like WebChat that need to restore an active chat session while navigating around a website. The side effect of using this type of cookie is they won't work when using test environment domain names such as "localhost" or an IP address. You must use a fully-qualified domain name (FQDN) such as "localhost.com" or any other variant that can be identified as a domain name. Cookies will also fail to work if you run the test site as an HTML file path directly in the browser.  
  
 
One workaround is to update your system's '''hosts''' file to create an FQDN alias for "localhost", your test environment's name, or an IP address.
 
One workaround is to update your system's '''hosts''' file to create an FQDN alias for "localhost", your test environment's name, or an IP address.
Line 58: Line 44:
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
|sectionHeading=Deployment methods
+
|sectionHeading=How can I deploy Genesys Widgets?
 
|Type=Structured
 
|Type=Structured
 +
|anchor=HowcanIdeployGenesysWidgets?
 
|alignment=Vertical
 
|alignment=Vertical
 
|gif=No
 
|gif=No
|structuredtext=Genesys supports two deployment methods:
+
|structuredtext=We support two deployment methods:
  
*{{Link-SomewhereInThisVersion|manual=Developer|topic=GWCDeployment|anchor=lazy|display text=Lazy loading}}—Lazy loading breaks the JavaScript bundle into individual plugin files and loads them into the page only as you need them. This is the preferred method of deploying Genesys Widgets.
+
*{{Link-SomewhereInThisManual|topic=GWCDeployment|anchor=lazy|display text=Lazy-Loading}}—Lazy-Loading breaks the JavaScript bundle apart into individual plugin files and loads them into the page only as you need them. This is the preferred method of deploying Genesys Widgets.
  
*{{Link-SomewhereInThisVersion|manual=Developer|topic=GWCDeployment|anchor=all|display text=All-in-one}}—The All-In-one method is the "classic" method of deploying Genesys Widgets. In this method, you have one JavaScript file and one CSS file that contain all plugins and resources.
+
*{{Link-SomewhereInThisManual|topic=GWCDeployment|anchor=all|display text=All-In-One}}—The All-In-One method is the "classic" method of deploying Genesys Widgets. In this method, you have one JavaScript file and one CSS file that contain all plugins and resources.
  
 
{{AnchorDiv|lazy}}
 
{{AnchorDiv|lazy}}
 
+
|fullwidth=No
===Lazy-loading deployment===
+
|Status=No
====Files====
+
}}{{Section
 +
|sectionHeading=Deploying Genesys Widgets (Lazy-Loading)
 +
|Type=Structured
 +
|anchor=DeployingGenesysWidgets(Lazy-Loading)
 +
|alignment=Vertical
 +
|gif=No
 +
|structuredtext====Files Used===
  
 
*'''widgets/cxbus.min.js'''
 
*'''widgets/cxbus.min.js'''
Line 77: Line 70:
 
*'''widgets/plugins/*.*'''
 
*'''widgets/plugins/*.*'''
  
You can use the following script to get started with lazy-loading deployment:
+
A good starting point is the following script:
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 89: Line 82:
 
#Loads '''cxbus.min.js'''. This makes the global CXBus instance available.
 
#Loads '''cxbus.min.js'''. This makes the global CXBus instance available.
 
#Configures CXBus to turn on debug logging and set the path to the Widgets plugin folder.
 
#Configures CXBus to turn on debug logging and set the path to the Widgets plugin folder.
#Loads your configuration file, in this case, '''widgets.config.js'''. (If you use a configuration file, you must create it yourself.)
+
#Load your configuration file, '''widgets.config.js'''. (This is an imaginary file. You must create it).
 
#Loads '''widgets-core''', the core Genesys Widgets library.
 
#Loads '''widgets-core''', the core Genesys Widgets library.
  
Line 98: Line 91:
 
{{NoteFormat|Whichever method you choose, you must ensure your configuration is in the page before you load '''widgets-core'''. Otherwise, '''widgets-core''' cannot read the configuration.}}
 
{{NoteFormat|Whichever method you choose, you must ensure your configuration is in the page before you load '''widgets-core'''. Otherwise, '''widgets-core''' cannot read the configuration.}}
  
{{NoteFormat|Refer to {{Link-SomewhereInThisVersion|manual=Developer|topic=GWCConfig|display text=this article}} for help configuring Genesys Widgets.}}
+
{{NoteFormat|Refer to this article for help {{Link-SomewhereInThisManual|topic=GWCConfig|anchor=top|display text=configuring Genesys Widgets}}.}}
 +
 
 +
===On-Demand Lazy-Loading===
 +
 
 +
Genesys Widgets is designed to load plugins into the page on-demand as you use the product. For example, if you call the command '''WebChat.open''', CXBus fetches the '''webchat.min.js''' plugin from the '''plugins/''' folder and loads it into the page. Any WebChat command triggers it to load. Likewise, WebChat calls WebChatService commands, thus CXBus loads '''webchatservice.min.js''' into the page as well.
  
====On-Demand Lazy Loading====
+
===Preloading Plugins===
Genesys Widgets is designed to load plugins into the page on demand as you use the product. For example, if you call the command '''WebChat.open''', CXBus fetches the '''webchat.min.js''' plugin from the '''plugins/''' folder and loads it into the page. Any WebChat command triggers it to load. Likewise, WebChat calls WebChatService commands, thus CXBus loads '''webchatservice.min.js''' into the page as well.
+
 
====Preloading Plugins====
+
In some cases, you might not want to load plugins on-demand, or the demand is to load them at startup. A good example is SideBar. You probably want this plugin to appear on the screen immediately so the customer can use it. To make this possible, you can specify which plugins you want to preload at startup in your configuration.
Sometimes you need to load your plugins on startup. For example, it's probably a good idea to have the SideBar plugin appear immediately, so the customer can use it right away. To do this, use the following JavaScript code:
 
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 114: Line 110:
 
</source>
 
</source>
  
You can specify as many plugins as you want in the preload list. The plugins load in order after you load Widgets Core.
+
You may specify as many plugins as you want in the preload list. The plugins load in order after you load Widgets Core.
  
 
All plugin names are lower-case. Please refer to the file names in the '''plugins/''' folder. For example, to preload '''webchat.min.js''', specify <tt>webchat</tt>, the first part of the file name.
 
All plugin names are lower-case. Please refer to the file names in the '''plugins/''' folder. For example, to preload '''webchat.min.js''', specify <tt>webchat</tt>, the first part of the file name.
  
Some of your other plugins might also need to be preloaded.
+
You may find other plugins or features of plugins that necessitate preloading.
  
 
{{AnchorDiv|all}}
 
{{AnchorDiv|all}}
===All-in-one deployment===
+
|fullwidth=No
====Files====
+
|Status=No
 +
}}{{Section
 +
|sectionHeading=Deploying Genesys Widgets (All-in-One)
 +
|Type=Structured
 +
|anchor=DeployingGenesysWidgets(All-in-One)
 +
|alignment=Vertical
 +
|gif=No
 +
|structuredtext====Files Used===
  
 
*'''widgets/widgets.min.css'''
 
*'''widgets/widgets.min.css'''
 
*'''widgets/widgets.min.js'''
 
*'''widgets/widgets.min.js'''
  
You can use the following script to get started with all-in-one deployment:
+
A good starting point is the following script:
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 133: Line 136:
 
<script src-"widgets/widgets.config.js"></script>
 
<script src-"widgets/widgets.config.js"></script>
 
<script src="widgets/widgets.min.js"></script>
 
<script src="widgets/widgets.min.js"></script>
<link id="genesys-widgets-styles" data-origID="genesys-widgets-styles"  data-origID="genesys-widgets-styles"  data-origID="genesys-widgets-styles"  href="http://www.yourhost.com/path/to/widgets.min.css" type="text/css" rel="stylesheet"/>
+
<link id="genesys-widgets-styles" data-origID="genesys-widgets-styles"  data-origID="genesys-widgets-styles"  data-origID="genesys-widgets-styles"  data-origID="genesys-widgets-styles"  data-origID="genesys-widgets-styles"  href="http://www.yourhost.com/path/to/widgets.min.css" type="text/css" rel="stylesheet"/>
  
 
</source>
 
</source>
Line 141: Line 144:
 
{{NoteFormat|Whichever method you choose, you must ensure your configuration is in the page before you load '''widgets.min.js'''. Otherwise, '''widgets.min.js''' cannot read the configuration.}}
 
{{NoteFormat|Whichever method you choose, you must ensure your configuration is in the page before you load '''widgets.min.js'''. Otherwise, '''widgets.min.js''' cannot read the configuration.}}
  
{{NoteFormat|Refer to {{Link-SomewhereInThisVersion|manual=Developer|topic=GWCConfig|display text=this article}} for help configuring Genesys Widgets.}}
+
{{NoteFormat|Refer to this article for help {{Link-SomewhereInThisManual|topic=GWCConfig|anchor=top|display text=configuring Genesys Widgets}}.}}
 +
 
 +
{{AnchorDiv|alternative}}
 +
==Alternative Deployment Script==
 +
 
 +
To simplify the deployment process while using tools like Google Tag Manager, you can use below script to embed Widgets.
 +
 
 +
<source lang="javascript">
 +
<script>
 +
    var widgetBaseUrl = 'https://apps.mypurecloud.ie/widgets/9.0/',
 +
        widgetScriptElement = document.createElement('script');
 +
           
 +
    widgetScriptElement.setAttribute('src', widgetBaseUrl + 'cxbus.min.js');
 +
 
 +
    widgetScriptElement.addEventListener('load', function () {
 +
       
 +
      CXBus.configure({debug: false, pluginsPath: widgetBaseUrl + 'plugins/'});
 +
      CXBus.loadPlugin('widgets-core');
 +
    });
 +
 
 +
    document.head.append(widgetScriptElement);
 +
</script>
 +
</source>
  
 
{{AnchorDiv|CDN}}
 
{{AnchorDiv|CDN}}
Line 147: Line 172:
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
|sectionHeading=Releases hosted on Genesys Content Delivery Network (CDN)
+
|sectionHeading=Releases hosted on Content Delivery Network (CDN)
 
|Type=Structured
 
|Type=Structured
 +
|anchor=ReleaseshostedonContentDeliveryNetwork(CDN)
 
|alignment=Vertical
 
|alignment=Vertical
 
|gif=No
 
|gif=No
|structuredtext=Genesys Widgets is now available over the Genesys Content Delivery Network (CDN), providing optimized load times and instant access to new releases.
+
|structuredtext=Genesys Widgets are now available over CDN, providing optimized load times and instant access to new releases.
 
 
  
<pre><br class="mw_emptyline">https://app.genesys.cloud/widgets/<version>/<filenames><br class="mw_emptyline"></filenames></version></pre>
+
<pre>
 +
https://apps.mypurecloud.com/widgets/<version>/<filename>
 +
</pre>
  
Note that <version> and <filenames> are placeholders.  
+
Note that <version> and <filename> are placeholders.  
  
</filenames></version>
+
===<filename>===
===<filenames></filenames>===
 
 
This value varies based on the deployment method you choose.
 
This value varies based on the deployment method you choose.
  
{{NoteFormat|If the CDN URL you are trying to access is '''not found''', either the release or the file you are looking for is not yet available.|2}}
+
{{NoteFormat|In the case where a CDN URL that you are trying to access is '''not found''', it means that either the release or the file you are looking for, is not yet available.|2}}
  
===<version></version>===
+
===<version>===
 
version can take one of the following 3 values.
 
version can take one of the following 3 values.
  
Line 171: Line 197:
 
*9.0.xxx.xx - (Major).(Minor).(Release candidate) - Specific release version
 
*9.0.xxx.xx - (Major).(Minor).(Release candidate) - Specific release version
  
For all the available released versions, refer to the [https://docs.genesys.com/Documentation/PSAAS/Public/RN/GW Widgets Release Notes].
+
For all the available released versions, refer to the {{Link-SomewhereInThisVersion|manual=|topic=GW|anchor=|display text=Genesys Widgets Releases notes - BROKEN LINK - }}.
 +
 
 +
===Choose Region===
 +
Widgets are available in a number of regions worldwide as shown below. Please choose the nearest or appropriate region URL based on where you are located in.
 +
 
 +
{{{!}} border="1"
 +
{{!}}-
 +
!Region
 +
!URL
 +
{{!}}-
 +
{{!}}North America
 +
{{!}}https://apps.mypurecloud.com/widgets/{version}/{path/to/file}
 +
{{!}}-
 +
{{!}}Australia or New Zealand
 +
{{!}}https://apps.mypurecloud.com.au/widgets/{version}/{path/to/file}
 +
{{!}}-
 +
{{!}}EU Ireland
 +
{{!}}https://apps.mypurecloud.ie/widgets/{version}/{path/to/file}
 +
{{!}}-
 +
{{!}}Japan
 +
{{!}}https://apps.mypurecloud.jp/widgets/{version}/{path/to/file}
 +
{{!}}-
 +
{{!}}Frankfurt
 +
{{!}}https://apps.mypurecloud.de/widgets/{version}/{path/to/file}
 +
{{!}}}
  
 
===Using Genesys Widgets CDN with versions===
 
===Using Genesys Widgets CDN with versions===
Starting in the 9.0.006.02 release, all of the released versions are accessible from the Genesys CDN URL. The sections below explain how to access the latest available released version or a specific released version using Genesys CDN.
+
Starting in the 9.0.006.02 release, all the released versions are accessible from the Genesys CDN URL. The sections below explain how to access the latest available released version or a specific released version using Genesys CDN.
  
 
=====To get the latest released version under the 9.0 family=====
 
=====To get the latest released version under the 9.0 family=====
https://app.genesys.cloud/widgets/9.0/widgets.min.js
+
https://apps.mypurecloud.com/widgets/9.0/widgets.min.js
  
 
=====To get the last available released version under a specific (Major).(Minor) version (this also includes any hot fixes for that release).=====
 
=====To get the last available released version under a specific (Major).(Minor) version (this also includes any hot fixes for that release).=====
https://app.genesys.cloud/widgets/9.0.xxx/widgets.min.js<br />
+
https://apps.mypurecloud.com/widgets/9.0.xxx/widgets.min.js<br />
'''Example:''' https://app.genesys.cloud/widgets/9.0.006/widgets.min.js
+
'''Example:''' https://apps.mypurecloud.com/widgets/9.0.006/widgets.min.js
  
 
=====To get a specific release/hot-fix version=====
 
=====To get a specific release/hot-fix version=====
https://app.genesys.cloud/widgets/9.0.xxx.xx/widgets.min.js<br />
+
https://apps.mypurecloud.com/widgets/9.0.xxx.xx/widgets.min.js<br />
'''Example:''' https://app.genesys.cloud/widgets/9.0.006.02/widgets.min.js
+
'''Example:''' https://apps.mypurecloud.com/widgets/9.0.006.02/widgets.min.js
  
{{NoteFormat|Release 9.0.006.02 and all subsequent versions are available in the CDN. However, some of the older versions of Genesys Widgets are not available there.}}
+
{{NoteFormat|Note that all older versions of Genesys Widgets may not be available in the CDN. All the released versions are available only starting with the 9.0.006.02 version.}}
  
 
===Versioning examples with scenarios===
 
===Versioning examples with scenarios===
Line 214: Line 264:
  
 
===Deployment Methods===
 
===Deployment Methods===
 +
 
====Lazy Loading====
 
====Lazy Loading====
'''Recommended approach:''' When using the lazy loading method, the base Genesys CDN URL must be prefixed in the {{Link-SomewhereInThisVersion|manual=Developer|topic=GWCDeployment|anchor=lazy|display text=lazy loading deployment script}}. The <filenames> value is not needed in this scenario because they are auto-loaded from the base CDN configured. Here is what the deployment script looks like when using 9.0.006.02 release:
+
'''Recommended approach:''' When using the lazy loading method, the base Genesys CDN URL must be prefixed in the {{Link-SomewhereInThisManual|topic=GWCDeployment|anchor=lazy|display text=lazy loading deployment script}}. The <filenames> value is not needed in this scenario because they are auto-loaded from the base CDN configured. Here is what the deployment script looks like when using 9.0.006.02 release:
  
 
<source lang="javascript">
 
<source lang="javascript">
<script src="https://app.genesys.cloud/widgets/9.0.006.02/cxbus.min.js" onload="javascript:CXBus.configure({debug:true,pluginsPath:''https://app.genesys.cloud/widgets/9.0.006.02/plugins/''});CXBus.loadFile('path/to/widgets.config.js').done(function(){CXBus.loadPlugin('widgets-core')});"></script>
+
<script src="https://apps.mypurecloud.com/widgets/9.0.006.02/cxbus.min.js" onload="javascript:CXBus.configure({debug:true,pluginsPath:''https://apps.mypurecloud.com/widgets/9.0.006.02/plugins/''});CXBus.loadFile('path/to/widgets.config.js').done(function(){CXBus.loadPlugin('widgets-core')});"></script>
 
</source>
 
</source>
  
 
====All-in-One====
 
====All-in-One====
'''Legacy approach (deprecated):''' When using the all-in-one deployment method, the values are the files mentioned in the {{Link-SomewhereInThisVersion|manual=Developer|topic=GWCDeployment|anchor=all|display text=All-in-one}} section. For example, if you would like to use widgets.min.js and widgets.min.css under 9.0.006.02 release, CDN URLs will look like this:
+
'''Legacy approach (deprecated):''' When using the all-in-one deployment method, the values are the files mentioned in the {{Link-SomewhereInThisManual|topic=GWCDeployment|anchor=all|display text=All-In-One}} section. For example, if you would like to use widgets.min.js and widgets.min.css under 9.0.006.02 release, CDN URLs will look like this:
  
 +
<pre>
 +
https://apps.mypurecloud.com/widgets/9.0.006.02/widgets.min.js
 +
https://apps.mypurecloud.com/widgets/9.0.006.02/widgets.min.css
 +
</pre>
  
<pre><br class="mw_emptyline">https://app.genesys.cloud/widgets/9.0.006.02/widgets.min.js<br class="mw_emptyline">https://app.genesys.cloud/widgets/9.0.006.02/widgets.min.css<br class="mw_emptyline"></pre>
+
{{NoteFormat|Lazy loading is the recommended method for Widgets. The ({{Link-SomewhereInThisManual|topic=GWCDeployment|anchor=all|display text=All-In-One}}) method is deprecated.}}
  
{{NoteFormat|Lazy loading is the recommended method for Widgets. The ({{Link-SomewhereInThisVersion|manual=Developer|topic=GWCDeployment|anchor=all|display text=All-in-one}}) method is deprecated.}}
+
<br />
 
|fullwidth=No
 
|fullwidth=No
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
|sectionHeading=For more information
+
|sectionHeading=Checking Widgets Version
|Type=Structured
+
|Type=Unstructured
|alignment=Vertical
+
|freetext='''CXBus.command("App.info");'''
|gif=No
+
 
|structuredtext=The following articles can help you set your up widgets correctly:
+
Prints out the debug header with version information.
  
*{{Link-SomewhereInThisVersion|manual=Developer|topic=GWCSupportedBrowsers|display text=Supported browsers}}
+
'''window._genesys.widgets.common.data("version");'''
*{{Link-SomewhereInThisVersion|manual=Developer|topic=GWCCookies|display text=Cookies}}
 
*{{Link-SomewhereInThisVersion|manual=Developer|topic=GWCConfig|display text=Configure widgets and services}}
 
*{{Link-SomewhereInThisVersion|manual=Developer|topic=GWCInternat|display text=Localize widgets and services}}
 
*{{Link-SomewhereInThisVersion|manual=Developer|topic=GWCCustomize|display text=Customize appearance}}
 
  
And these articles provide important information on the background and usage of Genesys Widgets:
+
Returns the version number directly, as a string.
  
*{{#mintydocs_link:|topic=WID/HIW|standalone}}
+
<br />
*The {{Link-SomewhereInThisVersion|manual=SDK|display text=Widgets API Reference}} covers all of the commands and events for each widget, and discusses how to configure and localize each one.
 
|fullwidth=No
 
 
|Status=No
 
|Status=No
 
}}
 
}}
|Role=Developer
 
 
}}
 
}}

Revision as of 20:27, December 24, 2019

This topic is part of the manual Widgets Developer's Guide for version Current of Widgets.

This guide provides the steps required to instrument your website with Genesys Widgets.

Related documentation:

Audience

This document is for website developers who are in charge of website code. You must have knowledge of HTML, JavaScript, and CSS.

Cookies

Genesys Widgets uses cookies to store non-sensitive data in the browser. These cookies are used to restore a chat session, to track the state of the UI, to store a user's decision, and more. The end-user's browser must allow cookies for Genesys Widgets to operate properly.

Important
No personally identifiable information (PII) is ever stored in cookies, local storage, or session storage by Genesys Widgets.

Sub-domains

Normally, cookies can not be transferred between sub-domains of a website unless they are configured to do so. Genesys Widgets automatically detects the domain of the host site and configures all cookies to be transferable between sub-domains. For example, you could start a chat on www.testsite.com and restore that chat session on store.testsite.com, support.testsite.com, or portal.testsite.com.

Cookie support in test environments

Genesys Widgets uses special cookies that persist across sub-domains. This is a critical feature for plugins like WebChat that need to restore an active chat session while navigating around a website. The side effect of using this type of cookie is they won't work when using test environment domain names such as "localhost" or an IP address. You must use a fully-qualified domain name (FQDN) such as "localhost.com" or any other variant that can be identified as a domain name. Cookies will also fail to work if you run the test site as an HTML file path directly in the browser.

One workaround is to update your system's hosts file to create an FQDN alias for "localhost", your test environment's name, or an IP address.

Example

  127.0.0.1       localhost
  127.0.0.1       localhost.com

A fully-qualified domain name (FQDN) such as "localhost.com" or any other variant that can be identified as a domain name is not mandatory but recommended. These cookies will also work when using test environment domain names such as "localhost" or an IP address.

How can I deploy Genesys Widgets?

We support two deployment methods:

  • Lazy-Loading—Lazy-Loading breaks the JavaScript bundle apart into individual plugin files and loads them into the page only as you need them. This is the preferred method of deploying Genesys Widgets.
  • All-In-One—The All-In-One method is the "classic" method of deploying Genesys Widgets. In this method, you have one JavaScript file and one CSS file that contain all plugins and resources.

Deploying Genesys Widgets (Lazy-Loading)

Files Used

  • widgets/cxbus.min.js
  • widgets/plugins/widgets-core.min.js
  • widgets/plugins/*.*

A good starting point is the following script:

<script src="widgets/cxbus.min.js" onload="javascript:CXBus.configure({debug:true,pluginsPath:'build/plugins/'});CXBus.loadFile('path/to/widgets.config.js').done(function(){CXBus.loadPlugin('widgets-core')});"></script>

This script does the following:

  1. Loads cxbus.min.js. This makes the global CXBus instance available.
  2. Configures CXBus to turn on debug logging and set the path to the Widgets plugin folder.
  3. Load your configuration file, widgets.config.js. (This is an imaginary file. You must create it).
  4. Loads widgets-core, the core Genesys Widgets library.

Use this script as a starting point and customize it as needed.

Remember that your configuration can be defined inline on the page or loaded in as a separate file (as shown in this script).

Important
Whichever method you choose, you must ensure your configuration is in the page before you load widgets-core. Otherwise, widgets-core cannot read the configuration.
Important
Refer to this article for help configuring Genesys Widgets.

On-Demand Lazy-Loading

Genesys Widgets is designed to load plugins into the page on-demand as you use the product. For example, if you call the command WebChat.open, CXBus fetches the webchat.min.js plugin from the plugins/ folder and loads it into the page. Any WebChat command triggers it to load. Likewise, WebChat calls WebChatService commands, thus CXBus loads webchatservice.min.js into the page as well.

Preloading Plugins

In some cases, you might not want to load plugins on-demand, or the demand is to load them at startup. A good example is SideBar. You probably want this plugin to appear on the screen immediately so the customer can use it. To make this possible, you can specify which plugins you want to preload at startup in your configuration.

    
    _genesys.widgets.main.preload = [

        "sidebar"
    ];

You may specify as many plugins as you want in the preload list. The plugins load in order after you load Widgets Core.

All plugin names are lower-case. Please refer to the file names in the plugins/ folder. For example, to preload webchat.min.js, specify webchat, the first part of the file name.

You may find other plugins or features of plugins that necessitate preloading.

Deploying Genesys Widgets (All-in-One)

Files Used

  • widgets/widgets.min.css
  • widgets/widgets.min.js

A good starting point is the following script:

<script src-"widgets/widgets.config.js"></script>
<script src="widgets/widgets.min.js"></script>
<link id="genesys-widgets-styles" data-origID="genesys-widgets-styles"  data-origID="genesys-widgets-styles"  data-origID="genesys-widgets-styles"  data-origID="genesys-widgets-styles"  data-origID="genesys-widgets-styles"  href="http://www.yourhost.com/path/to/widgets.min.css" type="text/css" rel="stylesheet"/>

First, you must define your configuration for Genesys Widgets. You can do this inline on the page by using a script tag, or you can store it in a separate file and load it in before widgets.min.js. In the script example above, we assume your configuration is stored in another file. You must create the widgets.config.js file for this script to function properly.

Important
Whichever method you choose, you must ensure your configuration is in the page before you load widgets.min.js. Otherwise, widgets.min.js cannot read the configuration.
Important
Refer to this article for help configuring Genesys Widgets.

Alternative Deployment Script

To simplify the deployment process while using tools like Google Tag Manager, you can use below script to embed Widgets.

<script>
    var widgetBaseUrl = 'https://apps.mypurecloud.ie/widgets/9.0/',
        widgetScriptElement = document.createElement('script');
	            
    widgetScriptElement.setAttribute('src', widgetBaseUrl + 'cxbus.min.js');

    widgetScriptElement.addEventListener('load', function () {
         
       CXBus.configure({debug: false, pluginsPath: widgetBaseUrl + 'plugins/'});
       CXBus.loadPlugin('widgets-core');
    });

    document.head.append(widgetScriptElement);
</script>

Releases hosted on Content Delivery Network (CDN)

Genesys Widgets are now available over CDN, providing optimized load times and instant access to new releases.

https://apps.mypurecloud.com/widgets/<version>/<filename>

Note that <version> and <filename> are placeholders.

<filename>

This value varies based on the deployment method you choose.

Tip
In the case where a CDN URL that you are trying to access is not found, it means that either the release or the file you are looking for, is not yet available.

<version>

version can take one of the following 3 values.

  • 9.0 - (Major) - A version that is company-wide or
  • 9.0.xxx - (Major).(Minor) - Minor version is product specific and is tied to each Widget’s iteration or
  • 9.0.xxx.xx - (Major).(Minor).(Release candidate) - Specific release version

For all the available released versions, refer to the Genesys Widgets Releases notes - BROKEN LINK -.

Choose Region

Widgets are available in a number of regions worldwide as shown below. Please choose the nearest or appropriate region URL based on where you are located in.

Region URL
North America https://apps.mypurecloud.com/widgets/{version}/{path/to/file}
Australia or New Zealand https://apps.mypurecloud.com.au/widgets/{version}/{path/to/file}
EU Ireland https://apps.mypurecloud.ie/widgets/{version}/{path/to/file}
Japan https://apps.mypurecloud.jp/widgets/{version}/{path/to/file}
Frankfurt https://apps.mypurecloud.de/widgets/{version}/{path/to/file}

Using Genesys Widgets CDN with versions

Starting in the 9.0.006.02 release, all the released versions are accessible from the Genesys CDN URL. The sections below explain how to access the latest available released version or a specific released version using Genesys CDN.

To get the latest released version under the 9.0 family

https://apps.mypurecloud.com/widgets/9.0/widgets.min.js

To get the last available released version under a specific (Major).(Minor) version (this also includes any hot fixes for that release).

https://apps.mypurecloud.com/widgets/9.0.xxx/widgets.min.js
Example: https://apps.mypurecloud.com/widgets/9.0.006/widgets.min.js

To get a specific release/hot-fix version

https://apps.mypurecloud.com/widgets/9.0.xxx.xx/widgets.min.js
Example: https://apps.mypurecloud.com/widgets/9.0.006.02/widgets.min.js

Important
Note that all older versions of Genesys Widgets may not be available in the CDN. All the released versions are available only starting with the 9.0.006.02 version.

Versioning examples with scenarios

When a new release version comes out, it is available under all the 3 different CDN URLs below. In this example, if 9.0.006.01 is the first ever release announced, then it is available under the following CDN URLs.

  • /9.0/
  • /9.0.006/
  • /9.0.006.01/

When 9.0.007.04 is released, it is available under /9.0/ but not under /9.0.006/ or /9.0.006.01/. Instead, /9.0.007/ and /9.0.007.04/ CDN URLs are created and this release is available under them:

  • /9.0/
  • /9.0.007/
  • /9.0.007.04/

If a hot fix (such as 9.0.006.02) is released after 9.0.007.04 is released, then the hot fix is available under the following CDN URLs:

  • /9.0.006/
  • /9.0.006.02/

If a hot fix (such as 9.0.007.05) is released before announcing any new release, then it is available under the following CDN URLs:

  • /9.0/
  • /9.0.007/
  • /9.0.007.05/

Deployment Methods

Lazy Loading

Recommended approach: When using the lazy loading method, the base Genesys CDN URL must be prefixed in the lazy loading deployment script. The <filenames> value is not needed in this scenario because they are auto-loaded from the base CDN configured. Here is what the deployment script looks like when using 9.0.006.02 release:

<script src="https://apps.mypurecloud.com/widgets/9.0.006.02/cxbus.min.js" onload="javascript:CXBus.configure({debug:true,pluginsPath:''https://apps.mypurecloud.com/widgets/9.0.006.02/plugins/''});CXBus.loadFile('path/to/widgets.config.js').done(function(){CXBus.loadPlugin('widgets-core')});"></script>

All-in-One

Legacy approach (deprecated): When using the all-in-one deployment method, the values are the files mentioned in the All-In-One section. For example, if you would like to use widgets.min.js and widgets.min.css under 9.0.006.02 release, CDN URLs will look like this:

https://apps.mypurecloud.com/widgets/9.0.006.02/widgets.min.js
https://apps.mypurecloud.com/widgets/9.0.006.02/widgets.min.css
Important
Lazy loading is the recommended method for Widgets. The (All-In-One) method is deprecated.


Checking Widgets Version

Comments or questions about this documentation? Contact us for support!