Analytics and events
Install a customer analytics provider on exported pages and configure section and row click events without custom JavaScript.
Two separate analytics systems
StaticPagesApi's own product analytics measure activity inside the app. Customer analytics for exported pages are configured separately so your public pages send events to your provider, not to StaticPagesApi's internal property.
Use page or Page Shell head scripts to install the provider, then use section and row event fields to decide which CTA or link clicks should fire events.
- App analytics: used only by StaticPagesApi layouts.
- Customer analytics: rendered into exported pages that you own.
- Full-document exports include the event bridge automatically when configured events exist.
- Body-only exports keep the data attributes, but the receiving site must provide the event bridge or equivalent click handling.
Install the analytics provider
Open the page edit form, or a Page Shell edit form for shared setup, and paste the provider script into Head scripts. This is where Google Analytics, Google Tag Manager, Plausible, Meta Pixel, or another provider is loaded for exported pages.
- Use Page Shell head scripts when many pages should share one provider setup.
- Use page head scripts for page-specific pixels, experiments, or campaign providers.
- Do not paste StaticPagesApi's internal GA id into customer pages.
- Head scripts are included only when the export mode includes the page head.
<!-- Example GA4 install script in Page or Page Shell Head scripts -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag("js", new Date());
gtag("config", "G-XXXXXXXXXX");
</script>
Configure click events
On section and row forms, analytics fields live inside each ordered Action. Fill in the event name and optional JSON params. The renderer adds safe data attributes to the link, and the exported full document includes a delegated click bridge.
- Each action contains label, url, style, status, event_name, and event_params.
- Set status to inactive to keep an action configured without rendering it; switch it back to active when it should appear.
- Actions retain their analytics configuration when reordered.
- Event names must start with a letter and use only letters, numbers, underscores, colons, or hyphens.
- Event params must be a JSON object with safe scalar values.
{
"actions": [{
"label": "Book a demo",
"url": "/demo",
"style": "primary",
"event_name": "demo_cta_clicked",
"event_params": { "placement": "hero", "campaign": "summer_launch" }
}]
}
What the export sends
Configured links render data attributes. The full-document export bridge listens for clicks and forwards the event to common provider globals when they exist.
- GA4: calls gtag("event", name, params).
- Google Tag Manager dataLayer: pushes an event object.
- Plausible: calls plausible(name, { props: params }).
- Meta Pixel: calls fbq("trackCustom", name, params).
- If no provider is present, the bridge no-ops.
<a
href="/demo"
data-customer-event-name="demo_cta_clicked"
data-customer-event-target="action"
data-customer-component-type="Section"
data-customer-component-id="42"
data-customer-event-params='{"placement":"hero"}'>
Book a demo
</a>
Safe event data
Keep analytics metadata useful but not sensitive. StaticPagesApi does not automatically send marketing copy, emails, Liquid content, raw HTML, or user-entered URLs as event params.
- Good params: placement, campaign, component_key, plan_tier, variant, audience, source.
- Avoid params containing names, emails, phone numbers, message text, form field values, long page copy, raw HTML, Liquid, or secrets.
- Use stable identifiers instead of human-written copy when possible.
- For destination-specific requirements, confirm the provider's event naming and privacy rules before publishing.
Liquid template support
Liquid templates iterate ordered actions and include each action's analytics_attributes string on its anchor. That backwards-compatible string also carries the action's link_target and secure rel attributes when a new tab is selected.
- Declare field_schema.actions.enabled and max_items when the template renders actions.
- Set an action's link_target to _self or _blank. New-tab actions automatically render rel="noopener noreferrer".
- Use section.actions or row.actions; numbered CTA and plain-link variables are not available.
{% for action in section.actions %}
<a href="{{ action.url }}" {{ action.analytics_attributes }}>{{ action.display_label }}</a>
{% endfor %}
{% for action in row.actions %}
<a href="{{ action.url }}" {{ action.analytics_attributes }}>{{ action.display_label }}</a>
{% endfor %}
© 2026 StaticPagesApi. All rights reserved.
Documentation, examples, prompts, templates, and API guidance are provided for authorized use with StaticPagesApi.