All Collections
Core Features
Plutio Chat Widget Integration With WordPress
Plutio Chat Widget Integration With WordPress
Leo Bassam avatar
Written by Leo Bassam
Updated over a week ago

Embedding Plutio messenger / chat widget onto your Wordpress website may require the following steps to fully work:

  1. Log in to your WordPress admin.

  2. Install the Code Snippets plugin.

  3. After installing and activating, inside the WordPress dashboard navigate to Snippets > Add New.

  1. Enter the title and paste the code below.

if (is_user_logged_in()) { add_action('wp_head', 'add_plutio_chat_widget'); add_action('admin_head', 'add_plutio_chat_widget'); } function add_plutio_chat_widget() { $plutioChatID = 'Add chat ID here'; $user_info = get_userdata(get_current_user_id()); $userID = 'user' . $user_info->ID; if ($user_info->first_name != '' ) { $userFirstName = $user_info->first_name; } else { $userFirstName = 'Client'; } $userEmail = $user_info->user_email; ?><script> (function (p, l, u, t, i, o) { p[t] = p[t] || function () { (p[t].q = p[t].q || []).push(arguments); }; o = l.getElementsByTagName('head')[0]; i = l.createElement('script'); i.async = 1; i.src = u; o.appendChild(i); })(window, document, '', '$plutio_msg'); $plutio_msg('<?php echo $plutioChatID; ?>', { user: { uniqueUserId: '<?php echo $userID; ?>', firstName: '<?php echo $userFirstName; ?>', contactEmails: [{ address: '<?php echo $userEmail; ?>', type: 'email' }] } }); </script><?php }
  1. Change the value of $plutioChatID variable on line 7 to your chat widget ID. For example, the final line of code should look like this: $plutioChatID = 'jyHa3cI4fTLQV74p';

  2. Choose where you want to show your chat widget. I wanted to show it only in the WordPress back-end, so I chose "Only run in administration area".

  3. Click on the "Save Changes and Activate" button.

Did this answer your question?