Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel6
outlinefalse
styledisc
typelist
printablefalse

Finding the widget code to share

Info

SourcesSurveys Share → Widget

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

You have the option to customize the widget's design and basic operations on this page.

The widget code has two parts: 

1) Widget element, use this wherever you prefer, it does not matter. 

2) Feedier API <script> tag to get the widget working. Add this to the end of your markup or right after the </body> tag.

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

Adding Context Attributes to the Widget

You'll want to attach metadata that you collect on your website/application in order to give better context to the feedback you collect. Some examples may be:

Company department

User Role

Management level

By adding attributes, when your user leaves feedback, their metadata is automatically attached to their feedback, allowing you to analyse this on the platform and build cohorts and develop trends.

Here’s how adding an attribute may look:
Standard widget code:

<script id="feedier-widget-script" src="https://feedier.com/js/widgets/v2/widgets.js?form-id=13&public-key=cb6c6eb920a84638d90e557d988193f8&no_header=true" type="text/javascript" async></script>

Widget code with context attributes 'user ID', 'Role', 'Signed up' added.

<script id="feedier-widget-script" src="https://feedier.com/js/widgets/v2/widgets.js?form-id=13&public-key=cb6c6eb920a84638d90e557d988193f8&no_header=true&user_id=1234&role=Premium&signed_up=14.02.21" async></script>


Testing the widget

Info

Open your console (CTRL/CMD + SHIFT + I) → Application → Storage → Local Storage → Feedier.widget → Delete widget cookies

In order to make sure the widget is running the way you’d like, you’ll need to clear the cookies to retest on your webpage.

For the best effectiveness, try to keep length to 3 to 5 questions for widgets

Advanced Settings

Manage the widget using JavaScript API  

Object: FeedierWidget

.toggle();

Code Block
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.

.init(options);

Code Block
FeedierWidget.init({
    form_id: 123,
    attributes: {
        department: marketing
    },
    forced: true
});

This method initializes the widget based on the options object.

option's 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 already replied to the survey before.

Example of adding attributes through Javascript:

Attributes are customizable for your own context. It is possible to attach any kind of data from the client-side using JavaScript (ES6/Jquery/Vue/Reach).  The attributes are used in Feedier to bring context and for reporting.

Code Block
FeedierWidget.init({
    form_id: 123,
    attributes: {
        browser: navigator.userAgent, // Attach the client's browser
        screen_width: window.innerWidth, // Attach the client's browser width 
        page: window.location, // Attach the client's URL
        user_id: $('#user-id').val() // Attach the user ID using Jquery if set in the DOM with ID user-id   
    },
});

When selecting attribute data, try to select datasets that help you measure your KPIs.

JavaScript Events 

When the widget is displayed on the page, the Feedier widget script will fire a 'FeedierWidget.built' event. It can be used automatically to open the widget or do other actions on the frontend. 

Code Block
document.addEventListener('FeedierWidget.built', function(e) {
      FeedierWidget.toggle();
});

JavaScript

Example: Display the Feedier widget on a custom button click through Javascript

Info

SourcesSurveys Share → Widget → Visibility

  • Toggle off the Show on Init option

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

In the DOM:

Code Block
<a href="#" id="feedback-start" class="btn btn-primary">
      Feedback
</a>

HTML

JS example to trigger the button with jQuery: 

Code Block
<script id="feedier-widget-script" src="https://feedier.com/js/widgets/v2/widgets.min.js?form-id=770&public-key={PUBLIC_KEY}&no_header=true" type="text/javascript" async></script>

<script type="text/javascript">
        $(document).ready(function() {
              $('#feedback-start').on('click', function () {
                     FeedierWidget.init({ form_id: 770, forced: true });
              });
       });
</script>

JavaScript

Example: Close the widget after feedback is completed

Code Block
 window.addEventListener('message', function(event) {
     if (event.data.eventName === 'feedback_completed') { $('.feedier-widget').hide() };
});

JavaScript

Changing the Widget style using CSS

There are two kinds of CSS changes: 

CSS Inside the form:

Info

Survey → Branding → Custom CSS

More info on CSS examples.

CSS on the widget: 

Info

Survey → Share→ Widget → Design

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

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

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 border across the survey:

Code Block
.feedier-widget__caller {
       background: #ce0707;
       color: #FFF;
       border: 0;
       font-family: Arial;
}

.feedier-widget__popup {
     padding: 0;
}

CSS

 

Showing the widget at specific events using Google Tag Manager

There are a number of advantages of using a Tag manager, including: No developer time needed, proactive feedback using triggered events, and attaching attributes easily

Create a new tag in Google Tag Manager

Info

Tag Manager → Add a new tag → Tag configuration → Paste Feedier widget code

Make sure to publish a new version of GTM when you make changes in your configuration (eg. you change the triggering method).

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

Using the Custom HTML under tag configuration, you can attach attributes via GTM. GTM will automatically replace the variables defined using their data layer. Eg. role={{user.role}}&plan={{user.plan}} becomes role=director&plan=enterprise

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.

Make sure that jQuery is loaded on the page. It's a common error. If your widget isn't loading, and you have no idea why, you can easily figue out if jQuery is the culprit. Open the console (right click on the page > "Inspect the page"). You will see the error that jQuery isn't loaded.