/
Sharing a survey via a web widget

Sharing a survey via a web widget

In regards to the Feedier widget,

  • The widget supports any question types, conditions, and design as does the regular surveys when they are not loaded through a widget.

  • The widget’s script is 100% cached and served through a CDN (Cloudflare). Also, the requests to Feedier’s backend to load the survey data are cached.

  • The widget options in Feedier are designed to remove as much developer resource as possible from the process.

  • When possible, we recommend using a Tag Manager system to load the Feedier widget.

Where to find the widget’s JS code?

SourcesSurveys Share → Widget

Select the button and click to copy to select the widget code.

Screenshot 2024-10-24 at 23.46.03-20241024-214609.png

 

Click the button Save and Preview to view your changes and Preview the widget.

Adding attributes to the Widget

Adding attributes is essential to making the feedback collected through the widget actionable from the Feedier Dashboard. It gives depth to the insights and helps detect trends or issues faster.

When adding the widget, very common attributes could be:

  • browser

  • user_id

  • geolocation

  • locale

  • user_role

  • version

  • screen_size

  • page_url

  • etc.

Method 1: adding attribute through the widget code URL

Attributes can be added by simply forwarding them in the URL of the widget code as GET parameters.

Here is an example to attach 3 attributes: user role, user id, signed-up date

<script id="feedier-widget-script" src="{endpoint}/js/widgets/v2/widgets.js?form-id={form}& public-key={public_key}& no_header=true& user_id=1234&user_role=Premium&signed_up_date=10.02.24" async></script>

Method 2: adding attributes through the JavaScript SDK

The widget can also be initialized through JavaScript and attributes can be passed in the configuration. This is very useful if the attributes data are coming after the content is loaded but through other components.

FeedierWidget.init({ form_id: {form_id}, attributes: { user_id: 'marketing', user_role: 'Premium', signed_up_date: '10.02.24' }, forced: true });

JavaScript SDK

The object loaded when the script is set is: FeedierWidget

The methods

.toggle();

FeedierWidget.toggle();

This method opens or closes the feedback widget’s content depending on the current status. It either shows the form or closes it.

For this option to work, the display delay must be set to 0.

.init(options);

This method initializes the widget based on the options object.

Option name

Type

Description

Option name

Type

Description

form_id

int

Feedier survey ID. It can be found in the API or on survey-> options → form management

attributes

object

Attributes to be attached to the feedback on Feedier. Attributes are contextual data coming from the client side.  

forced

boolean

If set to true, the widget will be displayed even if the user has already replied to the survey.

Listening to events

Widget event

The SDK will trigger events when the widget is built:

Survey events

The iframe loaded from the SDK will trigger events during the survey completion.

Whenever a question is answered,

The event.data, is an object with the following structure:

Whenever the survey is completed,

Testing the Feedier widget

Feedier will store a timestamp in the browser’s local storage when the user completes a widget linked to the survey ID.

To test the widget without having to wait for the expiration of the timestamp stored in the local storage (defined in the widget setting in Feedier), two options are available:

  1. Option 1: Pass a preview=true parameter to stop this behavior.

  2. Option 2: In the console, wipe out the Storage → Local Storage → Feedier.widget

Use Case 1: Display the Feedier widget on a custom button click through JavaScript

In the settings,

  • Toggle off the Show on Init option

  • Add in the Custom JavaScript Loaded option: FeedierWidget.toggle()

  • An example of trigger:

  • JS example to trigger the button with jQuery: 

Example: Close the widget after feedback is completed

Use-Case 2: Changing the Widget style using CSS

All CSS customizations can be managed within Feedier. However, on the widget side, it might be recommended to add these customizations directly through the site’s stylesheet.

Also, there are two types of CSS changes in the Feedier widget: 

Type 1: CSS Inside the form

The styling of the widget’s content, the form is loaded through the iframe and can be controlled here:

Type 2: CSS on the widget 

CSS can be added to your application OR under the Design section of the widget page.

CSS classes can be explored through the inspector, the most notable ones are: 

CSS class

Description

CSS class

Description

.feedier-widget__caller

Widget feedback button

.feedier-widget__popup

Widget iframe wrapper 

Example of adding CSS to the widget

The following example will set the widget button color to red, change its font, and remove the border across the survey:

Use-Case 3: Showing the widget at specific events using Google Tag Manager

Create a new tag in Google Tag Manager

Then, add an explicit Tag name like “Feedback Widget Feedier” and click the Tag Configuration icon:

 

Trigger GTM based on an event

In the Tag Configuration Settings, click “Triggering”. → Then click the “+” icon to configure when to trigger the widget.

Some examples of times you might like to trigger the widget:

  • Ask for feedback after signing up

  • Ask for feedback after 5th visit

  • Ask for feedback before leaving the app

  • Ask for feedback after achieving a product goal (ordering, booking, creating, updating…)

  • Ask for feedback after a user hasn’t followed an expected flow.

Use-Case 4: Showing the widget only once based on a specific attribute value

It’s possible in the Feedier Platform to restrict the widget visibility based on advanced ruled. One of the most common use case is to restrict the widget based on an attribute value.

So for example,

  • If the widget is loaded with user_id=123, and user_id=123 replies, the widget for this specific survey will never show up again.

To do this, go to Advanced settings and select the attribute in “Restrict access by attribute value“.

 

Related content

Partager une enquête avec Widget Web
Partager une enquête avec Widget Web
Read with this
React Native Sdk Integration
React Native Sdk Integration
More like this
Connecter Salesforce à Feedier
Connecter Salesforce à Feedier
Read with this
Understanding Attributes
Understanding Attributes
More like this
Connect Salesforce to Feedier
Connect Salesforce to Feedier
Read with this
Importing feedback via csv
Importing feedback via csv
More like this