Back to docs

Links

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

  1. Go to Appearance → Theme File Editor → header.php (or footer.php).

  2. 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>
    
  3. 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.

  1. Install a plugin like WPCode or Insert Headers and Footers.
  2. 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.
  3. Use data-styrar-track attributes in the block editor's Custom HTML block, or call window.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.

Join the beta waitlist

By signing up you agree to receive marketing email. See our Privacy Policy.