Skip to main content
TayStack

Install TayStack on WordPress

Add the TayStack script to the head of a WordPress site with a small theme snippet, then check that events arrive.

Not tested: Not yet tested on a live WordPress site. The steps follow how the platform is documented to work. Menu names change, so look for the setting described rather than the exact words.

WordPress prints whatever is hooked to wp_head into the head of every page. The snippet below hooks the tag there. Put it in a child theme, because a change to a theme's own functions.php is lost when the theme is updated.

Replace site_xxxxxxxx and your-domain.com with your own site id and domain. The dashboard's Install card shows the tag with your values filled in.

Add the script

PHP
<?php
// functions.php of a child theme
add_action( 'wp_head', function () {
    echo '<script defer data-website-id="site_xxxxxxxx" data-domain="your-domain.com" src="https://www.taystack.com/js/script.js"></script>';
} );

If you would rather not edit theme files, a plugin that adds code to the head of your site can hold the plain tag instead:

HTML
<script defer data-website-id="site_xxxxxxxx" data-domain="your-domain.com" src="https://www.taystack.com/js/script.js"></script>

Check it works

  1. Publish or deploy the change, then open your site on its real domain. Test addresses and editor previews may not match the domain you registered, and localhost is not tracked.
  2. Sign in, open your site in the dashboard and look at the Installation status. It reads “Waiting for the first event” until an event arrives, then “Receiving data”. It checks every few seconds while the page is open; the Verify installation button checks straight away.

To look at the request itself, follow the steps in Quick start.

If it does not work

  • Caching plugins keep copies of your pages. Clear the cache after adding the code.
  • Some themes and optimisation plugins move, delay or combine scripts. Exclude the TayStack script from them if it does not show up.
  • Ad blockers: some block analytics scripts and the script fails silently. Test in a private window with extensions off. See Troubleshooting.
  • Content Security Policy: if your site sends a Content-Security-Policy header, script-src must allow www.taystack.com and connect-src must allow it too, because events are sent there.
  • Caching: a page cache or CDN may still serve the old HTML without the script. Clear the cache, then reload.
  • Both data-website-id and data-domain must be present and match your site, or the script does nothing. More in Troubleshooting.

Back to all install guides.