Conversion pixel on WordPress
Install the Styrar conversion pixel on a WordPress site, with or without a plugin.
WordPress doesn't need anything special — the Styrar conversion pixel is just a <script> tag. No plugin is strictly required, though one makes it easier to manage.
Option A: theme editor
-
Go to Appearance → Theme File Editor → header.php (or
footer.php). -
Paste this just before
</head>(or</body>if you're using the footer file):HTML<script src="https://api.styrar.com/v1/pixel/styrar.js" async></script> -
Mark conversions anywhere in your templates or content:
HTML<button data-styrar-track="signup">Sign up</button>
Editing theme files directly gets overwritten on theme updates — use a child theme, or Option B, if you update your theme often.
Option B: a header/footer scripts plugin (recommended)
- Install a plugin like WPCode or Insert Headers and Footers.
- Add the same
<script src="https://api.styrar.com/v1/pixel/styrar.js" async></script>tag to the plugin's header slot — sitewide, or scoped to just the landing page your short link redirects to. - Use
data-styrar-trackattributes in the block editor's Custom HTML block, or callwindow.styrar.track(eventName, data)from an inline<script>in a Custom HTML block.
WooCommerce example
HTML
<script>
document.addEventListener('DOMContentLoaded', function () {
if (typeof wc_checkout_params !== 'undefined' && window.location.href.includes('order-received')) {
window.styrar && window.styrar.track('purchase', { value: <?php echo $order_total; ?> });
}
});
</script>
Place this on your order confirmation / "thank you" page template, using whatever your theme exposes for the order total.