Skip to main content
Using Userback with WordPress
Daniel Rae avatar
Written by Daniel Rae
Updated over a month 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 and click Connect

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

  3. From Userback menu in your WordPress instance 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.


Identify logged-in WordPress Users

Are you seeking a simple and effective way to track feedback from logged-in users on your WordPress website? Userback's JavaScript SDK can help you achieve that.

By identifying users and capturing their information along with their feedback, you can gain valuable insights into your user base. In this guide, we'll show you how to use User Identification with the JavaScript SDK to identify logged-in WordPress users.

1. Install the Userback WordPress Plugin

Before we delve into identifying logged in users with Userback's 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.

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() ) { ?>
<script>
<?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;?>',
}
};
</script>
<?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?