Plugins
Optional plugins that add site-wide functionality

Plugins

The Plugins resource allows for enabling of functionality site-wide. Normally these plugins also have configurable fields that change the behavior as well has fields that take account IDs or other credentials needed for the plugin to function. It is a sub-resource of "Site".

Supported plugins

Each plugin has specific fields. Documentation for the specific fields and example for each plugin can be found below.
plugin_type
customtag
Adds custom HTML to the header, footer, or prebody (right after <body>) of all pages within your Site
googletagmanager
Adds the Google Tag Manager tags to your site in the correct locations within the HTML

Plugin Model

Plugin object

A plugin object contains the following common fields
Attribute
Type
Description
id
integer
Unique id of the plugin
active
boolean
Inactive plugins maintain configuration but do not output on the Site
plugin_type
string
Type of the plugin (required)
site_id
integer
Reference id to the Site this plugin is under

Example object:

Below is an example of a googletagmanager plugin which has a field unique to this plugin account_id. Documentation for the specific fields for each plugin can be found further below.
1
{
2
"active": true,
3
"account_id": "PDTVXXX",
4
"id": 1234,
5
"plugin_type": "googletagmanager",
6
"site_id": 54321
7
}
Copied!

Create a plugin

POST /api/v2/sites/:site_id/plugins/:plugin_type/

Required fields

Attribute
active
plugin_type

List plugins

List all plugins for a Site ID including active and inactive
1
GET /api/v2/sites/:site_id/plugins/
Copied!

Response

1
{
2
"meta": {
3
"limit": 20,
4
"next": null,
5
"offset": 0,
6
"previous": null,
7
"total_count": 3
8
},
9
"objects": [
10
{
11
"account_id": "GA-XXXXXX",
12
"active": false,
13
"id": 12344,
14
"plugin_type": "googleglobalsitetag",
15
"site_id": 54321
16
},
17
{
18
"account2_id": null,
19
"account_id": "PDTXXXX",
20
"active": true,
21
"id": 12345,
22
"plugin_type": "googletagmanager",
23
"site_id": 54321
24
},
25
...
26
]
27
}
Copied!

Get a single plugin

Fetch the Plugin detail using the Site.id and Plugin.plugin_type. This endpoint can also be used to determine if a particular plugin is already added to a Site
1
GET /api/v2/sites/:site_id/plugins/:plugin_type/
Copied!

Update a plugin

PUT /api/v2/sites/:site_id/plugins/:plugin_type/

Delete a plugin

DELETE /api/v2/sites/:site_id/plugins/:plugin_type/

Custom Tag Plugin (customtag)

Adds custom HTML to the header, footer, or prebody (right after <body>) of all pages within your Site

Endpoint

1
GET /api/v2/sites/:site_id/plugins/customtag/
Copied!

Plugin object

In addition to the common fields, a customtag plugin object contains the following fields
Attribute
Type
Description
footer_template
string
HTML to add to the bottom of the page before the closing </body> tag
header_template
string
HTML to add to the end of the <head> tag
prebody_template
string
HTML to add to the start of the page right after the <body> tag

Example object:

1
{
2
"active": true,
3
"footer_template": "<script src=\"...\"...></script>",
4
"header_template": "<script src=\"...\"...></script>",
5
"id": 1234,
6
"plugin_type": "customtag",
7
"prebody_template": "<script src=\"...\"...></script>",
8
"site_id": 54321
9
}
Copied!

Google Tag Manager Plugin (googletagmanager)

Adds the Google Tag Manager tags to your site in the correct locations within the HTML

Endpoint

1
GET /api/v2/sites/:site_id/plugins/googletagmanager/
Copied!

Plugin object

In addition to the common fields, a googletagmanager plugin object contains the following fields
Attribute
Type
Description
account_id
string
The Google Tag Manager account ID, excluding the GTM- prefix

Example object:

1
{
2
"active": true,
3
"account_id": "PDTVXXX",
4
"id": 1234,
5
"plugin_type": "googletagmanager",
6
"site_id": 54321
7
}
Copied!
Last modified 1yr ago