You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/docs/pages/plug-sdk/web/methods.mdx
+29-11Lines changed: 29 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,16 @@ Passing `false` closes the chat widget.
61
61
window.plugSDK.toggleWidget(true);
62
62
```
63
63
64
+
## Check widget status
65
+
66
+
Use `isWidgetOpen` to determine whether your chat widget is currently open or closed.
67
+
68
+
```jsx
69
+
window.plugSDK.isWidgetOpen
70
+
```
71
+
72
+
This returns `true` if the chat widget is open and `false` if it is closed.
73
+
64
74
## Take action from PLuG chat events
65
75
66
76
This method allows you to listen for events from the PLuG widget. Below are the available values for `PAYLOAD_TYPE`.
@@ -82,16 +92,6 @@ useEffect(() => {
82
92
}, []);
83
93
```
84
94
85
-
## Check widget status
86
-
87
-
Use `isWidgetOpen` to determine whether your chat widget is currently open or closed.
88
-
89
-
```jsx
90
-
window.plugSDK.isWidgetOpen
91
-
```
92
-
93
-
This returns true if the chat widget is open and false if it is closed.
94
-
95
95
## Start conversation
96
96
97
97
The `startConversationContent` method opens the PLuG widget directly to the conversation creation view. It replicates the action of clicking the **Send us a message** button, launching the widget to the conversation initiation screen.
@@ -146,6 +146,16 @@ If no input is provided, the method toggles the search bar: opening it if it's c
146
146
window.plugSDK.toggleSearchAgent(true);
147
147
```
148
148
149
+
## Check Search Agent status
150
+
151
+
Use `isSearchAgentOpen` to determine whether the search agent is currently open or closed.
152
+
153
+
```jsx
154
+
window.plugSDK.isSearchAgentOpen
155
+
```
156
+
157
+
This returns `true` if the search agent is open and `false` if it is closed.
158
+
149
159
## Prefill search query in search agent
150
160
151
161
Use the `prefillSearchQuery` method to prefill a search query when opening and initializing the search agent.
You can use the `getSessionDetails` method to fetch the session ID and tab ID of currently ongoing session. These details can then be passed across different domains to maintain the journey as a single, continuous session.
To track user events using PLuG, utilize the `trackEvent` method available in the PLuG SDK. This method automatically links the event to the active user profile within the widget. For more details on user identification within the PLuG widget, refer to [Identify your users with PLuG](https://devrev.ai/docs/plug/identify-web-user).
188
+
To track user events using PLuG, utilize the `trackEvent` method available in the PLuG SDK. This method automatically links the event to the active user profile within the widget. For more details on user identification within the PLuG widget, refer to [Identify your users with PLuG](./user-identity).
Copy file name to clipboardExpand all lines: fern/docs/pages/plug-sdk/web/search.mdx
+41Lines changed: 41 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -70,3 +70,44 @@ You should now have the PLuG search widget installed on your website. Facing som
70
70
Once the widget is installed on your website, every user who visits your website is considered an anonymous user. Anonymous users are the users that come to your site and haven't yet logged in or shared any information.
71
71
72
72
After integrating the PLuG widget, you can personalize and contextualize customer engagement. Learn how to [identify your customers](./user-identity) and update their information.
73
+
74
+
## Bind a hotkey to toggle search agent
75
+
76
+
You can bind the `toggleSearchAgent` method to a hotkey, such as `Cmd + K` (or `Ctrl + K` for Windows), to toggle the search agent. Here's an example implementation:
77
+
78
+
<Tabs>
79
+
<Tabtitle="Setup">
80
+
```html
81
+
<script>
82
+
// Bind Cmd+K (or Ctrl+K) to toggle the search agent
83
+
document.addEventListener("keydown", function (event) {
84
+
if ((event.metaKey||event.ctrlKey) &&event.key.toLowerCase() ==="k") {
You can modify the keydown event listener to bind it to other keys, or key combinations, or use any other user events based on your application’s needs.
0 commit comments