npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wehelp/widget

v1.1.3

Published

Load the WeHelp widget into your website

Readme

@wehelp/widget

WeHelp widget package for embedding survey widgets into web pages.

Installation

npm install @wehelp/widget
# or
pnpm add @wehelp/widget
# or
yarn add @wehelp/widget

Simple usage

This is the minimum required to display the survey:

import loadWeHelpWidget from '@wehelp/widget';

loadWeHelpWidget({
  surveyToken: '[YOUR_SURVEY_TOKEN_HERE]', // token obtained at https://app.wehelpsoftware.com/
  person: {
    name: 'John Doe',
    companyUnit: '[UNIT_CODE]', // Person's unit of origin
    createdAt: '2005-03-14', // Person's creation date in your system (used for 'customer since')
    type: 'CUSTOMER', // 'CUSTOMER' | 'COLLABORATOR'

    // at least one of these three is required, which one depends on your company configuration at WeHelp
    email: '[email protected]',
    phone: '1234567890',
    internalCode: 'some-unique-internal-code',
  }
});

However, we strongly recommend sending all personal data needed for follow-up in the survey response.

Advanced usage

The widget can be usage in three different ways:

Option 1: ESM Import (recommended)

Import the widget as an ES module in your JavaScript/TypeScript code:

import loadWeHelpWidget from '@wehelp/widget';

loadWeHelpWidget({
  // required options
  surveyToken: '[YOUR_SURVEY_TOKEN_HERE]',
  person: {
    companyUnit: '[UNIT_CODE]',
    createdAt: '2005-03-14',
    name: 'John Doe',
    type: 'CUSTOMER',
    email: '[email protected]',
    phone: '1234567890',
    internalCode: 'some-unique-internal-code',
  },
});

Option 2: IIFE Script Tag

Load the widget using a script tag that exposes a global function window.WeHelp.loadWidget(options).

<script type="text/javascript" src="https://cdn.wehelpsoftware.com/survey-site/load.js"></script>

<script>
  window.onload = () => {
    window.WeHelp.loadWidget({
      surveyToken: '[YOUR_SURVEY_TOKEN_HERE]',
      person: {
        // required options
        name: 'John Doe',
        type: 'CUSTOMER',
        companyUnit: '[COMPANY_UNIT_CODE]',
        createdAt: '2020-01-01',

        // at least one of these must be informed
        email: '[email protected]',
        phone: '1234567890',
        internalCode: 'some-unique-internal-code',

        // optional data
        state: 'RJ',
        country: 'BRA',
        gender: 'M',
        document: '',
      },
      customFields: [
        {
          name: 'Custom Field Name',
          value: 'Custom Field Value'
        }
      ]
    });
  };
</script>

Option 3: Google Tag Manager

Create a custom HTML tag like the following:

<script>
(function() {
  var el = document.createElement('script');
  el.src = 'https://cdn.wehelpsoftware.com/survey-site/load.js';
  el.async = true;

  el.onload = function() {
    window.WeHelp.loadWidget({
      surveyToken: '[YOUR_SURVEY_TOKEN_HERE]',
      type: 'box',
      person: {
        name: {{userName}},
        type: 'CUSTOMER',
        createdAt: {{userCreatedAt}},
        companyUnit: {{userCompanyUnitCode}},
        internalCode: {{userInternalCode}},
        email: {{userEmail}},
        phone: {{userPhone}},
      }
    });
  };

  document.head.appendChild(el);
})();
</script>

The placeholders {{...}} are automatically replaced by the corresponding dataLayer variables. Make sure the variable names match your dataLayer. Apply which triggers you see fit to the tag.

Options reference

| Field | Required | Type | Default | Description | |------------------------|--------------|----------------------------------------------------------------|------------------------------------|--------------------------------------------------------------------------------------------------------| | surveyToken | Yes | string | — | Survey token provided at the survey widget settings. | | companyUnit | — | string | Same as person.companyUnit | Unit code that will be registered in the survey. | | language | — | 'PORTUGUESE' \| 'PORTUGUESE_PT' \| 'ENGLISH' \| 'SPANISH' | negotiated from browser's language | The language to display the survey. | | logLevel | — | 'trace' \| 'debug' \| 'info' \| 'warn' \| 'error' \| 'never' | 'warn' | Log level for console printing. | | experienceId | — | string \| number | — | Unique identifier of the action, usually used to store order number, service code, etc. | | type | — | 'modal' \| 'bar' \| 'box' | 'modal' | Widget layout type. | | forceOpen | — | boolean | false | Force message opening if survey has already been answered. | | customFields | — | Array<{ name: string; value: string \| number }> | — | Alias for person.customFields | | person.companyUnit | Yes | string | — | Person's origin unit code. | | person.name | Yes | string | — | Person's name. | | person.createdAt | Yes | string \| number \| Date | — | Person's creation date in your system. | | person.type | Yes | 'CUSTOMER' \| 'COLLABORATOR' | — | Person type. | | person.internalCode | Conditional¹ | string | — | Person's internal code. | | person.email | Conditional¹ | string | — | Person's email. | | person.phone | Conditional¹ | string | — | Person's phone. | | person.birthDate | — | string \| number \| Date | — | Person's date of birth. | | person.state | — | string | — | Person's state. (2 digits) | | person.country | — | string | — | Person's country. (3 digits) | | person.gender | — | 'M' \| 'F' | Inferred from person's name | Person's gender. | | person.document | — | string | — | Person's document. | | person.customFields | — | Array<{ name: string; value: string \| number }> | — | Custom fields to be sent along with the response. Values will be coerced to string | | elements.rootElement | — | HTMLElement \| string | document.body | Root element where the iframe will be mounted. Accepts an HTMLElement or the element id as a string. | | elements.iframeId | — | string | 'wehelp-widget-iframe' | ID of the iframe element created by the widget. | | elements.overlayId | — | string | 'wehelp-widget-overlay' | ID of the overlay element created by the widget. |

¹ Required depending on your company's auto-person-code configuration at WeHelp.

Snake_case aliases (survey_token, company_unit, etc.) are still accepted but deprecated.

Support

For bug reports and feature requests, please contact [email protected]