1.3.0-beta • Published 4 years ago

inweb-survey v1.3.0-beta

Weekly downloads
806
License
MIT
Repository
github
Last release
4 years ago

Built With Stencil

Inweb Survey

Cloudcherry brand logo

Web component as a channel for CEM for CloudCherry users. Light weight, deploy and forget tool for online feedback collection.

Looking for subtle non-intrusive channel to collect feedback from online platforms? Inweb Survey (CC Nanosurvey) is here to help. Supports 'Yes/No', 'Star', 'Smiley' questions. This can be followed up with a 'Single Answer' drop down question.

Nanosurvey sample

Measure quality of your website content or find out what went wrong with online experience. Correlate this data with CEM data from other channels. Take necessary course correction. Delight your customers.

Reach out to Support (support@getcloudcherry.com) to deploy this channel in bulk for your brand.

Getting Started

To start using this channel within your web application, follow one of below methods.

Script Tag

  • Add following script tags
    <script type="module" src='https://unpkg.com/inweb-survey/dist/inweb/inweb.esm.js'></script> <script nomodule src='https://unpkg.com/inweb-survey/dist/inweb/inweb.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc.

Node Modules

  • npm install inweb-survey
  • Put a script tag similar to this <script type="module" src='node_modules/inweb-survey/dist/inweb/inweb.esm.js'></script> <script nomodule src="node_modules/inweb-survey/dist/inweb/inweb.js"></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc.

In a stencil-app-starter app

  • Run npm install inweb-survey --save
  • Add an import to the npm packages: import inweb;
  • Then you can use the element anywhere in your template, JSX, html etc.

Using this component

<cc-inweb id="widget-usability" question="How are you today?" token="PC-56874" question-id='5c272306c3d98742b0f7d577'>
</cc-inweb>
  • question will be shown to user with thumbs up and down
  • token - survey token from CloudCherry CEM platform
  • question-id - id of the question from CloudCherry CEM platform

Prefill user information

Below the html tag, add the following code in a script tag

<script>
    // Sample usage for a section in a page
    // Avoid using inweb as variable name,it overwrites the global sdk

    var _inweb = document.querySelector('#widget-usability');

    _inweb.prefills = {
      '59f0762ed50981ce6442dab4': 'Alex',
      '5c272306c3d98742b0f7d576': 'Widgets',
    }
</script>
  • prefills is a dictionary with keys as question ids from CloudCherry CEM Platform and values are the prefill answers
  • These prefills will be submitted along with users response.

listen to response submission event

Every interaction to the component will emit an event on submission. Listen for cc-inweb-response event on the document as shown below

<script>
    document.addEventListener('cc-inweb-response', function ($event) {
      if($event.target.attributes.id === 'widget-usability'){
        <!-- react to response submission -->
      }
    })
</script>

$event.detail has the following payload

  • question has the current question shown to us
  • response is the user's choice of the answer. It would be 'true' or 'false'
  • prefills prefills that was submitted along with response
  • responseAsAnswer response as an answer format suitable for Cloudcherry CEM platform

Conditional Thank you text

Show different thank you texts based on user's response. Below script sets the property to the already added component.

<script>
  _inweb.conditionalThankYou = {
    'yes': 'Thank you for your positive feedback',
    'no': 'Sorry for the inconvinience'
  }
</script>

Hide icons

Not fond of thumbs? you can now show plain text instead of icons. Set the property 'icons' to 'hide'. This can be set in the html as property or set via Javascript

<script>
  _inweb.icons = 'hide';
</script>

Set a different identifier for cookie

You can set different cookie property for the component to use. Set in html using 'cookie-id' attribute or use the property 'cookieId' in JS

<script>
  _inweb.cookieId="my-cookie-name";
</script>

Throttle Survey for varying duration

Surveys are throttled by 3 days by default. You can set the attribute 'throttle-for-days' in html or set in Javascript using 'throttleForDays';

<script>
  _inweb.throttleForDays = 30;
</script>

Hide after submission

While throttling, you can choose to show the survey or hide it.

<script>
  _inweb.hideAfterSubmission = true;
</script>

Show followup question as drop down

You can show follow up options from each answer. This will show up once user answers a question. Add a followup question to post the response to.

_inweb.followUpQuestions = {
        Yes: ["Content", "Right to the point!"],
        No: ["Too Lengthy", "Does not makes sense"]
      };
_inweb.followUpQuestionId = "5c272306c3d98742b0f7d577";

If you need these options to be recorded as two different questions, use the following syntax.

_inweb.followUpQuestions = {
        Yes: {
          id: "5c272306c3d98742b0f7d577", // Positive followup question id
          multiSelect: ["Content", "Right to the point!"]
        },
        No: {
          id: "5c272306c3d98742b0f7d578", // Negative followup question id
          multiSelect: ["Too Lengthy", "Does not makes sense"]
        }
      };
_inweb.followUpQuestionId = "5c272306c3d98742b0f7d577";

Use survey configuration from dashboard

You can use the survey configuration from the CloudCherry dashboard. It will pick the first question (primary) that is supported and render it inline."Star-5", "Smile-5", "Select". Any following Single Select question with tag 'follow-up' will be take as follow up question. You can configure the conditions in the platform to show different followup options. A follow up question can have only on condition to it (dependent on primary question). You will also be able to take advantage of partial submission (if enabled from dashboard).

 <cc-inweb id="feedback" use-token="true" token="MR-13286"></cc-inweb>

Customize the component for your brand

Use css variables to set custom styles to the component

Variable nameFunctionalityDefault
--cc-inweb-colorText color#6a6a6a
--cc-inweb-font-weightFont Weight400
--cc-inweb-font-sizeFont Size15px
--cc-inweb-font-styleFont Style for textitalic
--cc-inweb-yes-colorColor for Yes icon/text--cc-inweb-color or #6a6a6a
--cc-inweb-no-colorColor for No icon/text--cc-inweb-color or #6a6a6a
--cc-inweb-icon-sizeSize of icons--cc-inweb-font-size or 15px
--cc-inweb-icon-marginmargin between icons--cc-inweb-icon-margin or 6px

Usage

Set style across the web page

<body style="--cc-inweb-color:blue">
</body>

Set style for one widget

<cc-inweb style="--cc-inweb-color: blue"></cc-inweb>

<cc-inweb style="--cc-inweb-color: red"></cc-inweb>

Position the follow up drop down

Show followup options above or below the question. By default, opens up above.

_inweb.position = 'above';
_inweb.position = 'below';

Multiline support

Show followup question with displayType as 'Multiline'

1.3.0-beta

4 years ago

1.2.3-beta

5 years ago

1.2.2-beta

5 years ago

1.2.1-beta

5 years ago

1.2.0-beta

5 years ago

1.1.0-beta

5 years ago

1.0.0-beta

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago