Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Session Persistence is the Web Widget’s ability to continue the session on a different page in on the same web domain where the widget is embedded. This functionality currently only works for pages loaded within the same tab of the browser.

In order to get the session persistence functionality, you would have to update must toggle on “enable cross page persistence” for the API keys key generated for the project to include the session persistence toggleSoul Machines Studio project.

  • Session persistence is only supported on Digital People on HumanOS 2.4+

  • The embed widget code snippet must be present included on every page that where you would want to embed the Digital Person on. Some websites allow for a “global embed” functionality and this feature can be used to have the widget appear on every single page on the website.

  • Using Page Reload, Page Back, and Page Forward buttons of the browser with session persistence enabled will mute the Digital Person once the page loads. This is intentional browser behavior since these actions are not “interactions with the domain” which is a policy implemented by most browsers to determine if autoplay is allowed. More information can be found in this Google article relating to autoplay.

Navigation using Content Cards

There are several ways to implement navigation if you have a persisted widget across multiple pages. As a conversation writer, you can use the Internal Links Card(s) to present links to the desired pages within your domain to the user. The user can then click on the card to navigate to the desired page. The page would reload to the new page and the Digital Person would resume the session from there.

Code Block
languagejson
{
  "output": {
    "generic": [
      {
        "values": [
          {
            "text": "Cool! let me show you how i can persist on different page loads with you. \\@showcards(internallink) \nLet's go to the Use Cases page together! \n#PauseTwo\n#PauseTwo\n"
          }
        ],
        "response_type": "text",
        "selection_policy": "sequential"
      }
    ]
  },
  "context": {
    "public-internallink": {
      "id": "internalLink",
      "data": {
        "url": "https://smitstage.wpengine.com/use-cases-copy/",
        "title": "Soul Machines Use Cases",
        "imageUrl": "https://smitstage.wpengine.com/wp-content/uploads/baseEightDP-2048x2048.png",
        "description": "End-to-end creativity and collaboration platform to enhance your digital worlds with AI avatars."
      },
      "type": "internalLink"
    }
  }
}

Example Code for navigation using Internal link Card

Navigation using links on the webpage

Clicking on a link within a webpage can redirect a user to another page, in which case widget embed code must be present on the possible navigable pages to make sure session persistence is maintained.

Custom DP Response on Page Load

Digital People can be trained to introduce a page with custom responses when When users are redirected to new pages. When , a Digital Person can greet them with custom responses. Upon loading a new page is loaded, we send a PageMetadata as the input to the NLP. We also set pageUrl as a variable that contains the PageMetadata andpageUrl (the URL of the loaded page. For training the intent, use PageMetadata ) are automatically sent as inputs to the configured NLP agent configured for the Digital Person project. Therefore to add a custom response per page:

  1. Add an NLP intent that utilizes thePageMetadata data as the training phrase.

In order to respond differently to various URLs, you will need to do a conditional response
  1. Add a different response based on each URL,

  2. Implement conditional responses based on thepageUrl.

More

Below, you'll find more specific examples provided below.

These examples aim to keep a welcome sentence for the user when they first connect and to not repeat unnecessary phrases or fallback if the URL is not set up to be recognized in the corpus.

Watson (Classic)

  1. In a Watson skill, set up

an
  1. intent with Page Metadata as a user example:

    Image Modified
  2. Moving to Dialog in the left-hand menu, modify Welcome to also trigger if the page metadata intent is triggered.

    Image Modified
  3. Add a child node underneath

welcome
  1. the Welcome node that recognizes the page loaded intent. 

    Image Modified
  2. Add a child node underneath the one you just created (in the screenshot above, it’s called Navigation). Using the $pageUrl that has been sent from the widget (no need to create this anywhere else in Watson), we can change what the assistant recognizes to change the response provided like below:

    Image Modified
  3. At the bottom of this node under “Then assistant should” change it to Jump To and select Navigation (If assistant recognizes (condition)).

    Image Modified
  4. Repeat steps 4 and 5 for as many URLs as you would like your corpus to recognize. Each should be a child node of Navigation like this:

    Image Modified

DialogFlow CX

Click the Start Page
  1. Configure Welcome intent as described in the section Configuring the welcome event.

  2. On the left side add a new page called “Determine Page”.

    Image Added
  3. Set “Transition” to “Determine Page” at “Welcome Event handler”.

    Image Added
  4. Click ““Determine Page” in the flow diagram to expand it.

  5. In the “Determine Page” Click the + button next to Route

(above Default welcome intent)
  1. .

  2. Click the Intent dropdown and select +new Intent.

  3. Choose a display name (in this case

Page Metadata
  1. “Page Metadata”) and add

page loaded
  1. “PAGE_METADATA” as the training phase.

Image Removed
  1. Image Added
  2. Save the intent

Make the fulfillment of the route your greeting message and change Transition to +new Page. Choose a Page name for the new page. In this case, it’s Determine page as this is where we will implement different routes based on different URLs
  1. .

  • Save the Route

  • Click the new page in the flow chart to expand it.

  • Click the + next to Routes

  • Change the Intent to use the same as the previous route (Page Metadata)
    1. Add a

    Condition
    1. “Condition” for if the $session.params.pageUrl =

    1. '[page url expected]

    ’Change the fulfillment
    1. '. This can be Or, And or a custom expression depending on if you’d like other conditions.

    Image Removed
    1. Add expected “Fulfillment” of what you would like

    your persona
    1. the DP to say and save the Route.

    Image Removed
    1. Image Added
    2. Change the Transition Page to the same one

    (Determine page)
    1. “Determine page” so that it loops.

    Image Removed
  • Repeat 9-13 for as many URLs as you would like this corpus to recognize. If the URL is not found, the persona will stay quiet unless it fulfills a different route of your choosing.

  • If you find that your persona is repeating the welcome message for URLs that have not been coded for then we can use parameters like so:

  • In the Start Page, page Metadata route set a condition for $session.parameter.welcome not equal to 1:

    Image Removed
  • In the same route, set the parameter to 1 after the route is triggered in parameter presets:

    Image Removed
  • If you would like to trigger a welcome message again in the same session, you will need to set the welcome parameter to something other than 1 using Parameter Presets in a route or form parameter.
    1. Image Added
    2. Add similar Routes in “Determine Page” for different page URLs, or you can create a Route group and include all “Page Metadata” intent within one route group.

      Image Added

    Contents

    Table of Contents