Skip to main content
Using Userback with WordPress
Daniel Rae avatar
Written by Daniel Rae
Updated over a week ago

The Userback plugin for WordPress allows you to gather feedback effortlessly from all of your WordPress pages, including specific or draft pages. You won't need to install any code.

Installing the Userback WordPress Plugin

Follow these simple steps below to integrate your Userback Projects with WordPress

  1. Select the Project, Click Settings then go to Integrations

  2. On the WordPress integration click the Download button and Install the plugin into your WordPress

  3. Go to the Userback menu in your WordPress instance and Click the 'Get your access token here' link and copy your widget access token

  4. Select the pages you would like to widget to be enabled on. For example, All Pages or All Draft Pages

  5. Check the Enable Userback checkbox and click Save

If installed correctly, you will see the feedback widget on the pages that you selected within the plugin settings.

How to identify logged-in WordPress Users

Follow the steps below to automatically identify your WordPress users, eliminating the need for them to fill in their information.

1. Install the Userback WordPress Plugin

Before we delve into identifying logged-in users with Userback JavaScript SDK, you need to install the Userback WordPress plugin. If you don't have it installed yet, you can download and activate it from the WordPress plugin repository or by following the steps above.

2. Add this code to your WordPress theme file

Next, add the following code snippet to your WordPress theme file (typically footer:php), whilst it is recommended, we implore you to find a location that suits your needs.

This code dynamically outputs user information (only if a user is logged in) which is then captured by the Userback Widget and included it with their submitted feedback.

<?php if ( is_user_logged_in() ) { ?>
<?php $current_user = wp_get_current_user(); ?>
Userback.user_data = {
id: <?php echo ''.$current_user->ID;?>,
info: {
username: '<?php echo ''.$current_user->user_login;?>',
email: '<?php echo ''.$current_user->user_email;?>',
name: '<?php echo ''.$current_user->user_firstname;?> <?php echo ''.$current_user->user_lastname;?>',
display_name: '<?php echo ''.$current_user->display_name;?>',
<?php } ?>

3. Test the code and track user feedback

Now that the code has been added to your theme file, it's time to test it out.

Log in to your WordPress site and submit feedback through the Userback widget. You should see the user's information displayed alongside their feedback in your userback project dashboard. With this information at your fingertips, you'll be able to better understand your users' needs and improve your website or web application accordingly.

Did this answer your question?