🀩 Advanced Micro-surveys

Capture Timely Insights with Event-Driven Micro-Surveys

Level up user engagement by automatically triggering context-specific micro-surveys at pivotal interactions within your application. You can leverage open(), widget_settings and setData() to get real-time, targeted feedback.

This elevates our Widget Templates to an entirely new dimension of customization.

πŸ” Company Plan or higher required - Uses JavaScript SDK, more details here.

Prerequisites

  • Userback Widget installed and initialized

Basic Use Cases

File Upload Completed

Automatically ask for feedback once a user successfully uploads a file.

// Trigger on successful file upload
function fileUploadCompleted() {
    Userback.setData({
        action_name: 'File Upload'
    });
    Userback.open('general', 'form');
}

User Hits a 404 Page

Automatically display a survey as soon as a user lands on a 404 page. Embedded directly within the 404 page.

// Immediately trigger on 404 page load
window.addEventListener('load', function() {
    Userback.setData({
        action_name: '404 Page'
    });
    Userback.open('bug', 'form');
});

Advanced Use Cases

Subscription Renewal Feedback

This function will prompt for feedback when there are 30 days or fewer left for subscription renewal.

function checkSubscriptionEndDate(endDate) {
    const daysToRenewal = Math.floor((new Date(endDate) - new Date()) / (1000 * 60 * 60 * 24));
    if (daysToRenewal <= 30) {
        Userback.setData({
            action_name: 'Subscription Renewal',
            days_to_renewal: daysToRenewal
        });
        Userback.widget_settings = {
            form_settings: {
                general: {
                    rating_type: "star",
                    rating_help_message: "How satisfied are you with our service so far?"
                }
            }
        };
        Userback.open('general', 'form');
    }
}

Time Spent on a Feature

This function opens a feedback form after a user spends 2 minutes on a specific feature.

let timeSpent = 0;
setInterval(() => {
    timeSpent += 1;
    if (timeSpent >= 120) {
        Userback.setData({
            action_name: 'Time Spent on New Feature',
            time_on_feature: `${timeSpent}s`
        });
        Userback.widget_settings = {
            form_settings: {
                general: {
                    rating_type: "emoji",
                    rating_help_message: "How do you feel about this new feature?"
                }
            }
        };
        Userback.open('general', 'form');
    }
}, 1000);

User Watches a Product Demo Video on YouTube

Automatically solicit user feedback when a YouTube video finishes playing, providing insights into their interest level.

Dependencies: Uses YouTube Player API for iframe Embeds.

// Include the YouTube Iframe API in your HTML or dynamically load it in your script

// Initialize the YouTube player
function onYouTubeIframeAPIReady() {
    var player = new YT.Player('videoId', {
        events: {
            'onStateChange': function(event) {
                if (event.data === YT.PlayerState.ENDED) {
                    demoVideoWatched();
                }
            }
        }
    });
}

// Function to trigger Userback form after video ends
function demoVideoWatched() {
    Userback.setData({
        action_name: 'Demo Video Watched'
    });
    Userback.open('feature_request', 'form');
}

Instructions:

  1. Ensure the YouTube Iframe API is included on the same page as the video.
  2. Replace 'videoId' with the actual ID of your YouTube video iframe element.
  3. Ensure Userback is initialized on the page.

This setup listens for the video's ENDED state and triggers a Userback form to capture user feedback.


Support & Further Reading

For more information, consult the JavaScript SDK Documentation.

Encounter issues? Please send a message to our support team.