On WordPress (with or without WooCommerce) the pixel goes in the header of every page. The simplest way, and one that survives theme updates, is a free code insertion plugin. This guide uses WPCode, one of the most installed in the official WordPress directory. If you already use a similar plugin, the steps are equivalent.
Before you start
- You need a self-hosted WordPress site where you can install plugins, with an administrator user.
- Create the campaign in Notikit with the site domain.
1. Copy the pixel code in Notikit
- Log in to Notikit and open Campaigns.
- If you do not have a campaign for this store yet, create one with the domain your customers see (for example
mystore.com). The pixel only works when the page domain matches the campaign domain. More details in Create your first campaign. - In the campaign, choose Install pixel and click Copy pixel code.
The code looks like this (the key is different for each campaign):
<!-- Pixel Code - https://notikit.com/ -->
<script defer src="https://notikit.com/pixel/YOUR_PIXEL_KEY"></script>
<!-- END Pixel Code -->
Recommended: the Notikit plugin for WordPress. In your WordPress go to Plugins → Add New, search for Notikit (or download it from wordpress.org/plugins/notikit), install and activate it. In Settings → Notikit paste the pixel code (or just the key) in Pixel key and save. If you use the plugin, skip steps 2 and 3.
2. Install WPCode
- In the WordPress dashboard, go to Plugins and choose the option to add a new plugin.
- Search for WPCode. Its full name is "WPCode – Insert Headers and Footers + Custom Code Snippets".
- Click Install Now and then Activate.
3. Paste the pixel in the header
- In the left menu, go to Code Snippets > Header & Footer.
- You will see three fields: Header, Body and Footer. Paste the pixel code into Header.
- Click Save Changes, at the top right.
If you deactivate WPCode, the code stops loading.
4. Clear the cache
- If you use a cache plugin or a CDN, clear the cache so pages are rebuilt with the new code.
- If a plugin combines, minifies or delays JavaScript, make sure it is not blocking the
notikit.comscript. If notifications do not show, exclude that script from optimization.
5. Check that it works
- Open the store in a private window, on its real domain.
- View the page source and search for
notikit.com/pixel/. The key after it must match the one in Install pixel. - Enable one notification in the campaign. For the test, set the trigger to Delay with a few seconds and the frequency to Always, then reload the page.
- If nothing shows, open the browser console: pixel messages start with
Notikit (https://notikit.com/):and tell you what is missing (for example, that the domain does not match the campaign). - After a few minutes of traffic, Statistics shows the impressions.
Every message is explained in Verify the pixel installation.
6. Show real sales as "Recent purchases"
The pixel only displays notifications. For a recent purchases notification to show real sales, Notikit has to hear about each sale. That is what the webhook is for: every Recent sales & conversions notification has its own address that receives a message for each sale, like a mailbox.
- In Campaigns, open the store campaign, click Create notification and choose the Recent sales & conversions type.
- In the notification, open the Data source tab and copy the URL in the Webhook trigger field. It looks like this:
https://notikit.com/pixel-webhook/NOTIFICATION_KEY. - With the Notikit plugin you do not need any automation: paste that URL in Settings → Notikit → Recent purchases (WooCommerce) → Notification webhook URL, choose which data to send, save and click Send test order. The plugin sends each collected sale once (online payments when paid; cash on delivery, bank transfer and check when you mark them Completed). If you do not use the plugin, set up an automation that sends a
POSTto that URL for each sale with three fields: first name, product and city. - In the Main tab, use those fields as variables. For example, title
{name} from {city}and descriptionBought {product}. - To see what arrived, open the notification and go to Data: each sale received is listed with the Webhook type.
An example of what the webhook should receive for each sale:
curl --request POST \
--url 'https://notikit.com/pixel-webhook/NOTIFICATION_KEY' \
--header 'Content-Type: application/json' \
--data '{"name": "Jane", "product": "Sneakers", "city": "Austin", "order": "1042"}'
Be careful with personal data. The webhook stores everything it receives. Send only what you will display (first name, product and city) and do not point the platform order notification straight at it, because it includes the buyer's email, phone and address. The order number makes two identical purchases count as two.
WooCommerce has its own webhooks (WooCommerce > Settings > Advanced > Webhooks), but they send the full order, including the buyer's details. Do not point them straight at Notikit: send them to your automation, which forwards only the three fields.
If you prefer not to automate, you can also import sales from a CSV file: Data: import and use variables. All webhook rules are in Track conversions with webhook.
Sources
- WordPress.org: WPCode – Insert Headers and Footers.
- WPCode: Using the Global Header & Footer settings.