triggers_create
Create custom triggers in Piwik PRO Tag Manager to define when tags fire based on user interactions like page views, clicks, or form submissions using JSON attributes.
Instructions
Create a new trigger in Piwik PRO Tag Manager using JSON attributes.
Only trigger types listed by `templates_list_triggers()` are supported. Any other type will be refused.
💡 TIP: Use these tools to discover available trigger templates and their requirements:
- templates_list_triggers() - List all available trigger templates
- templates_get_trigger(template_name='page_view') - Get detailed requirements
This tool uses a simplified interface with 2 parameters: app_id and attributes.
Use tools_parameters_get("triggers_create") to get the complete JSON schema
with all available fields, types, and validation rules.
Args:
app_id: UUID of the app
attributes: Dictionary containing trigger attributes for creation. Required fields vary by trigger type:
- name: Trigger name (always required)
- trigger_type: Trigger type (e.g., 'page_view', 'click', 'form_submission')
- conditions: Array of condition objects that define when trigger fires
- Additional fields may be required depending on trigger type
Returns:
Dictionary containing created trigger information including:
- data: Created trigger object with id, name, trigger_type, and attributes
- Trigger conditions and configuration
Template Discovery:
Use templates_list_triggers() to see all available trigger templates, or
templates_get_trigger(template_name='TEMPLATE') for specific requirements.
Parameter Discovery:
Use tools_parameters_get("triggers_create") to get the complete JSON schema
for all available fields. This returns validation rules, field types, and examples.
Examples:
# Get available trigger templates first
templates = templates_list_triggers()
# Get specific template requirements
page_view_info = templates_get_trigger(template_name='page_view')
# Create page view trigger
attributes = {
"name": "Homepage Page View",
"trigger_type": "page_view",
"conditions": [
{
"condition_id": "9efa6364-8982-45c5-a288-cdabdf7a4001",
"variable_id": "page-path-variable-uuid",
"condition_type": "equals",
"value": "/",
"options": {}
}
]
}
# Create click trigger
attributes = {
"name": "CTA Button Click",
"trigger_type": "click",
"conditions": [
{
"condition_id": "8efa6364-8982-45c5-a288-cdabdf7a4002",
"variable_id": "click-element-variable-uuid",
"condition_type": "equals",
"value": "#cta-primary",
"options": {"selector_type": "css"}
}
]
}
Input Schema
Name | Required | Description | Default |
---|---|---|---|
app_id | Yes | ||
attributes | Yes |
Input Schema (JSON Schema)
{
"properties": {
"app_id": {
"title": "App Id",
"type": "string"
},
"attributes": {
"additionalProperties": true,
"title": "Attributes",
"type": "object"
}
},
"required": [
"app_id",
"attributes"
],
"type": "object"
}