MetaCRM Widget
This guide provides instructions on how to implement and customize the MetaCRM Widget in your web application.
Last updated
This guide provides instructions on how to implement and customize the MetaCRM Widget in your web application.
Last updated
Follow the video tutorial or the installation guide below to set up your Customer Service Widget
This API key auto-generated and is already included in the provided installation snippet below.
If you need a new set of API keys for compliance or security reasons, you can use the regenerate button to do so. However, this will also generate a new set of installation snippets, which will need to be reintegrated into your website.
Provide the URL of your website where you want to install the Customer Service Widget.
When switching from testing stage to production, make sure to change the domain name to maintain the functionality of the Customer Service Widget.
Copy the provided installation snippet and paste it right before the closing </head> element as shown in the example below.
We strongly recommend installing our Enhanced Address Identification Method so you can track all wallet connections, including non-browser wallets, such as WalletConnect.
Please refer to the example code above and consult your devs on how to install Enhanced Address Identification Method.
You can dynamically hide or show the widget based on the current page or route using the window.MetaCRMWidget.setHide()
function. Hereâs a example of how to hide the widget on specific pages of your React application:
Import necessary dependencies:
Use the useLocation
hook to detect the current path:
Implement the useEffect
hook to control widget visibility:
This code will hide the widget when the user navigates to the '/objective' path and show it on all other pages.
You can delay loading the widget until a specific user action occurs.
To delay the loading of the widget script:
Add the delayLoad: true
option to the MetaCRMWidget.init()
function:
Create a button or trigger to load the widget when needed:
This approach allows you to control when the widget is loaded, which can be useful for improving initial page load times or conditionally loading the widget based on user interactions
To have the widget open automatically when the page loads, simply add the defaultOpen: true
option to the widget initialization:
This configuration will ensure that the widget is open by default when the page loads, providing immediate visibility to users.
By implementing these features, you can customize the behavior of the MetaCRM Widget to best suit your application's needs and user experience requirements.
Manual wallet connection ensures the widget always has the correct, current wallet address, especially useful when:
Your site uses custom wallet connection methods.
You're using specific Web3 libraries not automatically detected by the widget.
Your application supports multiple chains or has complex connection flows.
Without manual connection, the widget may not always be in sync with your application's wallet state.
Hereâs a React example using wagmi:
This implementation does the following:
It calls manualConnectWallet
immediately if the widget is already loaded.
It sets up an event listener for 'MetaCRMLoaded' to connect the wallet when the widget loads.
It cleans up the event listener when the component unmounts.
Note: If your application doesn't use wagmi
, you'll need to replace the useAccount
hook with whatever method you're using to obtain the wallet address.
Remember to call manualConnectWallet
whenever the wallet address changes in your application to keep the widget in sync.
By implementing manual wallet connection, you ensure that the MetaCRM Widget is always aware of the current wallet address, allowing for seamless integration with your application's existing wallet management system.