While it's recommended to use the built-in Trigger configurations we offer in the app, in some cases, you may want further customizations for when to trigger a Feedback Campaign. In this article, we'll show an example of how to trigger your Feedback Campaigns using code.

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 can 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}']);

Note: 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 2: Triggering a campaign manually will not override any other limitations in the campaign, like page rules.

Did this answer your question?