Skip to main content
Notice removed Authoritative reference needed by CommunityBot
Bounty Ended with no winning answer by CommunityBot
added 103 characters in body
Source Link

Example:

enter image description here

Example:

enter image description here

added 374 characters in body
Source Link

In this code I tried:

embedded_svc.settings.extraPrechatFormDetails = [{
        "label": "URL",
        "value":  window.location.href,
        "displayToAgent": true
      }];

But this does not work as expected. At the end of the chat I would still like to have a history of all the pages visited during the chat and possibly a timestamp.

In this code I tried:

embedded_svc.settings.extraPrechatFormDetails = [{
        "label": "URL",
        "value":  window.location.href,
        "displayToAgent": true
      }];

But this does not work as expected. At the end of the chat I would still like to have a history of all the pages visited during the chat and possibly a timestamp.

added 43 characters in body
Source Link

The javascript is loaded on every page.

The goal is to see where the customer is on the website at all times.

The code

<script type='text/javascript' src='https://service.force.com/embeddedservice/5.0/esw.min.js'></script>
<script type='text/javascript'>
    var initESW = function(gslbBaseURL) {
        embedded_svc.settings.displayHelpButton = true; //Or false
        embedded_svc.settings.language = 'nl'; //For example, enter 'en' or 'en-US'
        embedded_svc.settings.offlineSupportMinimizedText = 'Chat met een expert';
        embedded_svc.settings.defaultMinimizedText = 'Chat met een expert'; //(Defaults to Chat with an Expert)
        //embedded_svc.settings.disabledMinimizedText = '...'; //(Defaults to Agent Offline)

        embedded_svc.settings.loadingText = 'laden...'; //(Defaults to Loading)
        //embedded_svc.settings.storageDomain = 'yourdomain.com'; //(Sets the domain for your deployment so that visitors can navigate subdomains during a chat session)

        // Settings for Chat
        //embedded_svc.settings.directToButtonRouting = function(prechatFormData) {
            // Dynamically changes the button ID based on what the visitor enters in the pre-chat form.
            // Returns a valid button ID.
        //};
        var accountData = document.getElementById('myaccount') && document.getElementById('myaccount').dataset.account;
        if(accountData) {
          var accountDataObject = JSON.parse(accountData);
          embedded_svc.settings.prepopulatedPrechatFields = {
              FirstName: accountDataObject.first_name,
              LastName: accountDataObject.last_name,
              Email: accountDataObject.email
          };
        }
      
      embedded_svc.settings.extraPrechatFormDetails = [{
        "label": "URL",
        "value":  window.location.href,
        "displayToAgent": true
      }];
        
        //embedded_svc.settings.fallbackRouting = []; //An array of button IDs, user IDs, or userId_buttonId
        //embedded_svc.settings.offlineSupportMinimizedText = '...'; //(Defaults to Contact Us)

        embedded_svc.settings.enabledFeatures = ['LiveAgent'];
        embedded_svc.settings.entryFeature = 'LiveAgent';

        embedded_svc.init(
            'https://xxx.my.salesforce.com',
            'https://xxx.secure.force.com/liveAgentSetupFlow',
            gslbBaseURL,
            '',
            'Chat_Team',
            {
                baseLiveAgentContentURL: 'https://c.la1-c2-fra.salesforceliveagent.com/content',
                deploymentId: '',
                buttonId: '',
                baseLiveAgentURL: 'https://d.la1-c2-fra.salesforceliveagent.com/chat',
                eswLiveAgentDevName: 'Chat_Team',
                isOfflineSupportEnabled: true
            }
        );
    };

    if (!window.embedded_svc) {
        var s = document.createElement('script');
        s.setAttribute('src', 'https://xxx.my.salesforce.com/embeddedservice/5.0/esw.min.js');
        s.onload = function() {
            initESW(null);
        };
        document.body.appendChild(s);
    } else {
        initESW('https://service.force.com');
    }
</script>

The javascript is loaded on every page.

The goal is to see where the customer is on the website at all times.

The code

<script type='text/javascript' src='https://service.force.com/embeddedservice/5.0/esw.min.js'></script>
<script type='text/javascript'>
    var initESW = function(gslbBaseURL) {
        embedded_svc.settings.displayHelpButton = true; //Or false
        embedded_svc.settings.language = 'nl'; //For example, enter 'en' or 'en-US'
        embedded_svc.settings.offlineSupportMinimizedText = 'Chat met een expert';
        embedded_svc.settings.defaultMinimizedText = 'Chat met een expert'; //(Defaults to Chat with an Expert)
        //embedded_svc.settings.disabledMinimizedText = '...'; //(Defaults to Agent Offline)

        embedded_svc.settings.loadingText = 'laden...'; //(Defaults to Loading)
        //embedded_svc.settings.storageDomain = 'yourdomain.com'; //(Sets the domain for your deployment so that visitors can navigate subdomains during a chat session)

        // Settings for Chat
        //embedded_svc.settings.directToButtonRouting = function(prechatFormData) {
            // Dynamically changes the button ID based on what the visitor enters in the pre-chat form.
            // Returns a valid button ID.
        //};
        var accountData = document.getElementById('myaccount') && document.getElementById('myaccount').dataset.account;
        if(accountData) {
          var accountDataObject = JSON.parse(accountData);
          embedded_svc.settings.prepopulatedPrechatFields = {
              FirstName: accountDataObject.first_name,
              LastName: accountDataObject.last_name,
              Email: accountDataObject.email
          };
        }
      
      embedded_svc.settings.extraPrechatFormDetails = [{
        "label": "URL",
        "value":  window.location.href,
        "displayToAgent": true
      }];
        
        //embedded_svc.settings.fallbackRouting = []; //An array of button IDs, user IDs, or userId_buttonId
        //embedded_svc.settings.offlineSupportMinimizedText = '...'; //(Defaults to Contact Us)

        embedded_svc.settings.enabledFeatures = ['LiveAgent'];
        embedded_svc.settings.entryFeature = 'LiveAgent';

        embedded_svc.init(
            'https://xxx.my.salesforce.com',
            'https://xxx.secure.force.com/liveAgentSetupFlow',
            gslbBaseURL,
            '',
            'Chat_Team',
            {
                baseLiveAgentContentURL: 'https://c.la1-c2-fra.salesforceliveagent.com/content',
                deploymentId: '',
                buttonId: '',
                baseLiveAgentURL: 'https://d.la1-c2-fra.salesforceliveagent.com/chat',
                eswLiveAgentDevName: 'Chat_Team',
                isOfflineSupportEnabled: true
            }
        );
    };

    if (!window.embedded_svc) {
        var s = document.createElement('script');
        s.setAttribute('src', 'https://xxx.my.salesforce.com/embeddedservice/5.0/esw.min.js');
        s.onload = function() {
            initESW(null);
        };
        document.body.appendChild(s);
    } else {
        initESW('https://service.force.com');
    }
</script>
added 150 characters in body
Source Link
Loading
Notice added Authoritative reference needed by Thomas Theunen
Bounty Started worth 50 reputation by Thomas Theunen
Source Link
Loading