In this article, you will learn about the different options you have when choosing how and when your Feedback campaign widgets appear to your visitors.


Choosing a trigger

Mouseflow comes with a variety of triggering options built in as well as the ability to fully customize the trigger using JavaScript. To decide which is the best option for you, you will want to look closely at your use-case for the Feedback Campaign and determine which type of trigger will yield the most responses from your customers.


You can determine whether a feedback campaign continues to appear for a visitor by changing the persistence under the Trigger settings. The show once per user option will prevent the campaign from appearing by using a cookie set in the user's browser.

Page Rules

You can use the page rules to select which pages your feedback campaign will appear on. These rules work the same way as in the Recording Controls.


You can further customize the triggering logic for your feedback campaign by selecting a segment of your visitors. This can be useful if you want to localize different campaigns for different languages, or if you want to only show the feedback survey to desktop users.

Different types of triggers

Trigger on


Page loadOnce the page has loaded, the feedback campaign will appear.
DelayAdd a number of seconds to wait before the feedback campaign appears.
ScrollUser must scroll down a specified percentage of the page height before feedback campaign appears.
InactivityWait until the user has been inactive for a number of seconds before showing the feedback survey.
Mouse leaves pageOnly show survey once the user has moved their mouse cursor away from the page. This can be moving the mouse into the web browser's UI or on to a different tab, window, or program on the computer.
Click rageUse Mouseflow's click-rage detection to trigger the feedback survey to appear.
Click errorUse Mouseflow's click error detection to trigger the feedback survey to appear.
ManualUse code to trigger the survey to appear

Using code to trigger a feedback survey

When setting up a Feedback campaign you have the option of using manual triggers. This means you can have your campaign triggered by any custom event on your website. 

This can be when your visitor clicks a button or comes from a certain source - or any other event you need. To trigger a campaign, you need to call a simple function. You can call the function as part of your Mouseflow tracking code or add it as a stand-alone script. Here's an example of the function as a standalone script:

<script type="text/javascript"> 
    window._mfq = window._mfq || []; 
    window._mfq.push(['activateFeedback', '{FEEDBACK-ID}']);

In this example you will need to replace the placeholder {FEEDBACK-ID} with the ID of the campaign in question. This ID is visible when you select the manual trigger and can also be seen in the URL of the campaign.

Note: Triggering a campaign manually will not override any other limitations in the campaign, like page rules. 

For example, if the campaign is set up to fire only on the page "/contact", you can't trigger it manually on other pages. The same is true for segmenting - if the campaign is set to fire for specific languages, visitor types or device types, it can't be triggered it if these details don't match. 

Trigger a campaign when clicking an element

To trigger a campaign on a click event, you need to create a click handler for the element that should be clicked. In this example, we'll have the user click a button:

<button id="feedback_button" type="button">Start Feedback Campaign</button> 

Using the ID of this button, we can easily create a click handler: 

<script type="text/javascript">
    $('#feedback_button').click(function() {
        window._mfq = window._mfq || []; 
        window._mfq.push(['activateFeedback', 'QMBELz7bIUufA-Mpn9Yplg']);

Testing a feedback campaign live

You may want to test your feedback campaign before deploying it to your users.

If you would like to preview the feedback campaign before deploying it to your users, we recommend you use the manual trigger setting.

Once you have set up the manual trigger for your feedback campaign, you will want to take the line of JavaScript provided and run it in your browser's console using the developer tools.

Copy the line of JavaScript provided, and go to the page where you are wanting to see the campaign triggered. Make sure you are being recorded by Mouseflow, otherwise the campaign won't appear. Open the browser's developer tools (instructions for Chrome), enter the line of code provide into the console, and hit enter.

Tip: To test the feedback campaign multiple times, use incognito/private browsing mode.

Trigger a campaign for specific referrers

You can target visitors from a certain source with your feedback campaigns. In this example, we'll target all visitors from First, we'll use the document.referrer property in JavaScript.

This property will return a string containing the URL of the referral page. If that page was, the string could look like

We can then use JavaScript to look at the value of this property for each visitor and trigger the Feedback campaign accordingly. In this case, we'll look for the value ''

<script type="text/javascript">
    if (document.referrer.indexOf('') > -1) {
        window._mfq = window._mfq || []; 
        window._mfq.push(['activateFeedback', 'QMBELz7bIUufA-Mpn9Yplg']);

The above code will trigger the Feedback campaign for each visitor from