WordPress
Add Quotient website tracking to WordPress.com or a self-hosted site
When someone clicks a link in a Quotient email and lands on your WordPress site, you want to know what happens next. Quotient's JavaScript pixel records the visit and the pages they view while preserving the original campaign, email, or social post as the source.
Install the pixel with WPCode, a free plugin that adds code to every page without changing your theme. The same steps work for self-hosted WordPress and WordPress.com sites that support plugins.
Before You Start
You need administrator access to WordPress and a plan that allows plugins. If you use WordPress.com, check its current plan requirements before you start.
Create your API key in
Settings → Developers. Choose a
Public key and give it the Analytics: write permission. Add your site's
domain, such as https://example.com, to its allowed origins. This prevents
other websites from using your key.
The key should begin with pk_. Never put a private sk_ key in WordPress or
any other browser code.
Install the Pixel with WPCode
- In your WordPress dashboard, go to Plugins → Add New Plugin.
- Search for WPCode – Insert Headers and Footers + Custom Code Snippets.
- Click Install Now, then Activate.
- Go to Code Snippets → Header & Footer.
- Paste the following code into the Footer field, replacing
pk_replace_with_your_public_keywith the public key you copied from Quotient:
<script src="https://unpkg.com/@quotientjs/client@0.6.2/dist/quotient.browser.js"></script>
<script>
Quotient.QuotientClient.init({
apiKey: "pk_replace_with_your_public_key",
});
</script>
- Click Save Changes.
WPCode must remain active. See its Header & Footer guide if you cannot find the Footer field.
Clear Your Site's Cache
If you use a caching plugin, managed host, or service such as Cloudflare, clear its cache after saving the code. Otherwise, WordPress may keep serving an older version of the site without the pixel.
Check the Installation
Visit the public site and move between a few pages. To confirm that the pixel is sending data:
- Open your browser's developer tools and select Network.
- Reload the page.
- Search the requests for
analytics/web. - Select the request and confirm that its status is
200.
The pixel records the current page when it loads and tracks later navigation automatically. If page views appear twice, remove any older copy of the Quotient snippet from your theme or analytics plugins.
If the request returns 403, check the key's allowed origins and Analytics:
write permission. If there is no request, make sure WPCode is active, the
snippet is in the Footer field, and your site's cache has been cleared.
Privacy and Consent
The pixel stores device and session identifiers in the visitor's browser. Your privacy notice and consent setup should cover this tracking. If you require consent before loading analytics, configure your consent plugin to run the Quotient snippet only after the visitor accepts analytics tracking.