> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: addSitePlugin() ## Article: addSitePlugin() ## Article Link: https://dev.wix.com/docs/sdk/host-modules/dashboard/add-site-plugin.md ## Article Content: # addSitePlugin() > **Developer Preview** > This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period. Adds a site plugin to one of the slots supported in an [app created by Wix](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/apps-created-by-wix.md). You can specify a single slot in which you want to add the plugin, or add the plugin to one of the available slots based on a list of prioritized slots that you configure in the plugin's installation settings in your [app's dashboard](https://manage.wix.com/account/custom-apps). > **Notes:** > - This method isn't supported for [developing sites](https://dev.wix.com/docs/develop-websites.md) or when writing code within [Blocks](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/about-wix-blocks.md). > - Before using this method, you need a site plugin extension. Learn more about [site plugins](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/site-plugins/about-site-plugin-extensions.md). ## Method Declaration ```ts (pluginId: string, options: { placement?: PluginPlacement }) => Promise ``` ## Parameters | Name | Type | Description | |:--------------|:--------------------------------------------|:-----------------------| | `pluginId` | `string` | ID of your site plugin, which you can find in your app's dashboard, in the site plugin extension's settings. | | `options` | [addSitePluginOptions](#addsitepluginoptions-object) | Options to use when adding a site plugin. | ### addSitePluginOptions object ```ts { placement?: PluginPlacement; } ``` | Name | Type | Description | |:--------------|:--------------------------------------------|:-----------------------| | `placement` | [PluginPlacement](#pluginplacement-object) | Optional. Details of the slot in which you want to add the plugin. You can find this information in the articles about the [slots that are available on Wix app pages](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/site-plugins/supported-wix-app-pages/about-slots.md). If you do not include this property, your plugin is placed in the first available slot according to the order you defined in the plugin's installation settings in your app's dashboard. If that slot is occupied, it is added in the next available slot, and so on. If there are no available slots, it is not added.| ### PluginPlacement object ```ts { appDefinitionId: string; widgetId: string; slotId: string; } ``` | Name | Type | Description | |---|---|---| | `appDefinitionId` | `string` | ID of the app created by Wix whos widget you want to add your plugin to. You can find the IDs of these apps in [this list of apps created by Wix](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/apps-created-by-wix.md). | | `widgetId` | `string` | ID of the host widget in which the slot is located. A host widget is a widget provided by an app created by Wix. Check the [slots documentation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/site-plugins/supported-wix-app-pages/about-slots.md) to find the IDs of site widgets provided by apps created by Wix. | | `slotId` | `string` | ID of the slot in the host widget.| ## Returns ```ts Promise ``` ## Errors The `addSitePlugin()` method can reject with the following errors: | Code | Message | |---|---| | 3001 | Slot occupied | | 3002 | Slot not found | | 3003 | Error adding plugin | | 3004 | Error replacing existing plugin | | 3005 | Error loading modal data | | 3006 | Aborted by user | | 3007 | Site not published yet | ## Examples > **Note:** To call this method in [self-hosted apps](https://dev.wix.com/docs/sdk/articles/get-started/about-self-hosted-apps.md), you need to create a [client](https://dev.wix.com/docs/sdk/articles/set-up-a-client/about-the-wix-client.md). See the [setup](https://dev.wix.com/docs/sdk/host-modules/dashboard/introduction.md) guide for more details. ### Add a site plugin to a specific slot ```ts import { dashboard } from '@wix/dashboard'; const pluginId = '975bffb7-3c04-42cc-9840-3d48c24e73d5'; const pluginPlacement = { appDefinitionId: '13d21c63-b5ec-5912-8397-c3a5ddb27a97', widgetId: 'a91a0543-d4bd-4e6b-b315-9410aa27bcde', slotId: 'slot1', }; dashboard.addSitePlugin(pluginId, { placement: pluginPlacement }) .then(() => { console.log('Plugin added successfully'); }) .catch(error => { console.error('Error adding plugin:', error); }); ``` ### Add a site plugin without specifying a slot ```ts import { dashboard } from '@wix/dashboard'; const pluginId = '975bffb7-3c04-42cc-9840-3d48c24e73d5'; dashboard.addSitePlugin(pluginId, {}) .then(() => { console.log('Plugin added successfully'); }) .catch(error => { console.error('Error adding plugin:', error); }); ```