This tutorial provides the steps to setup and install HubSpot CRM chat widget in WordPress site similar to what we have on Designody.
You can use the Plugin and Install it by following the tutorial.
STEP 1
Click on Conversations > Chatflows and Edit your Chat widget.
STEP 2
At the same Page on Conversations > Chatflows. Click on More and Go to inbox settings.
STEP 3
Now Customize and Click on Tracking Code and Copy it.
STEP 4
It is the time to Install the code. You can paste it in Header or Footer script section of your theme or can download a plugin to put it. Like I made a quick search https://www.google.com/search?q=header+footer+script+plugin
Customization
The default setup will show Hubspot chat on all pages if no condition is set for all users. It is possible to hide and show it based on WordPress conditional tag but it’s not come by default in Hubspot.
If you are looking for manual configuration and restrict the Hubspot CRM code for some specific members then this will work best.
OPTION 1. For all users but Not for Admin
Add the following code in functions.php
//* Add hubspot chat before closing <body> add_action( 'wp_footer', 'dy_hubspot_chat', 100 ); function dy_hubspot_chat() { if ( current_user_can('administrator') ) { return; } ?> <!-- Start of HubSpot Embed Code --> <script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/6055630.js"></script> <!-- End of HubSpot Embed Code --> <?php }
OPTION 2. For Logged-in users Not for general visitors.
Add the following code in functions.php
//* Add hubspot chat before closing <body> add_action( 'wp_footer', 'dy_hubspot_chat', 100 ); function dy_hubspot_chat() { if ( ! is_user_logged_in() ) { return; } ?> <!-- Start of HubSpot Embed Code --> <script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/6055630.js"></script> <!-- End of HubSpot Embed Code --> <?php }
Use only one option. Replace the
<!-- Start of HubSpot Embed Code --> <script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/6055630.js"></script> <!-- End of HubSpot Embed Code -->
with your code.
Plugin:
https://wordpress.org/plugins/leadin/
Documentation:
https://knowledge.hubspot.com/articles/kcs_article/integrations/install-the-hubspot-wordpress-plugin
https://knowledge.hubspot.com/articles/kcs_article/reports/install-the-hubspot-tracking-code