- Administering Live Experience
- Add the Live Experience Widget to Your Site
Add the Live Experience Widget to Your Site
Add the Live Experience widget on every page in the customer portal.
- Download the Oracle Live Experience JavaScript SDK and unzip the contents into a customer portal folder called lx under /cp/customer/assets.
- Upload the folder back to the server with WebDAV.
-
Edit the
autoload.js
script in the /cp/customer/development/javascript directory. Append the script with the following:// Code to add the LX widget to every page const scriptElement = document.createElement('script'); scriptElement.setAttribute('src', "/euf/assets/lx/lib/require.js"); scriptElement.onload = function() { require.config({ baseUrl: "/euf/assets/lx/js", paths: { jquery:"../lib/jquery", text:"oracle.live.api", css:"oracle.live.api", "oracle.live.api":"oracle.live.api", "oracle.live.style":"oracle.live.style", "oracle.live.button":"oracle.live.api", "oracle.live.messages":"oracle.live.api", "oracle.live.sdk":"oracle.live.api" }, shim:{jquery:{exports:["jQuery","$"]}} }); require(["oracle.live.api"], function(liveApi) { const getAuthToken = (callback) => { fetch(new Request("/cc/LX/auth")) .then(response => { return response.json(); }) .then(auth => { callback(auth.access_token, auth.expires_in); }); }; getAuthToken((myAuthToken, myTokenExpiry) => { liveApi.controller.service.address = "https://<LX_DOMAIN>"; liveApi.controller.service.clientID = "<CLIENT_ID>"; liveApi.controller.service.userID = "<END_USER_EMAIL>"; liveApi.controller.service.tenantID = "<LX_TENANT>"; liveApi.controller.service.authToken = myAuthToken; liveApi.controller.service.authRefresh(myTokenExpiry, () => { app.getAuthToken((jwt) => { liveApi.controller.service.authToken = jwt; }); }); liveApi.controller.contextAttributes.set("appLocation", "Basic Guidance"); liveApi.controller.addComponent(); }); }); }; document.head.appendChild(scriptElement);
-
Replace <CLIENT_ID> with the client ID of the application you created earlier.
-
Replace <LX_TENANT> with the name of your Live Experience tenant.
-
Replace <LX_DOMAIN> with the fully qualified domain name of the Live Experience region your tenant is located in: US (Phoenix): live.oraclecloud.com or EMEA (Frankfurt): emea.live.oraclecloud.com.
-
Replace <END_USER_EMAIL> with a valid email address. Live Experience does not need this to be a real email address of the customer, for example you can just use anonymous@example.com if your customers are not signed in.
-
- When you are done, save the file and upload it back to the server with WebDAV.