Install Varly on WooCommerce or WordPress

Install the Varly plugin for WooCommerce and WordPress. It adds the snippet and sends your orders, linked to each visit.

In this article

WooCommerce runs on WordPress, so the steps are the same for both.

  1. In Varly, open your site and click Install. Under 1., pick WooCommerce (or WordPress if your site doesn't sell online).
  2. Under 2. Install the Varly plugin, click Download the Varly plugin.
  3. In WordPress, go to Plugins → Add New → Upload Plugin, choose the downloaded file and click Install Now. Then click Activate.
  4. In WordPress, open Settings → Varly. Paste the Site key that Varly shows next to the download button. It starts with pk_. Click Save.

For orders (WooCommerce only):

  1. In Varly, go to 5. Connect your orders on the Install page. An Owner clicks Create API key. If a key already exists, the button reads Create new API key.
  2. Copy the key right away: Varly shows it only once.
  3. In WordPress, open Settings → Varly, paste it as Order API key and click Save.

What the plugin does:

  • It adds the Varly snippet to the top of every page. If you already added the snippet another way (for example with Google Tag Manager or in your theme), remove that copy, or untick Add the Varly snippet to every page.
  • It sends every paid order (status Processing or Completed) to Varly in the background, so checking out never gets slower.
  • After a refund or cancellation it sends the order again with the new total (0 for a cancelled order), so revenue in Varly stays right.
  • It links each order to the visit: on normal pages it remembers the visit in a cookie, after the visitor accepted cookies, and saves it with the order at checkout.

Varly receives only the order number, total, currency, number of items, the time and the visit. No names, addresses or email addresses.

If an order can't be sent, the plugin adds a note to the order in WooCommerce and tries again with the next status change.

Option 2: a header plugin or your theme

Use this for a WordPress site without WooCommerce, or if you can't install plugins. You then add only the snippet; orders need the order API.

First get the snippet: on the Install page, under 2. Install the Varly plugin, open Prefer to paste the snippet yourself? and click the copy button next to the code.

With a plugin: install a plugin that adds code to the header of every page (search the plugin directory for "insert headers"), and paste the snippet into its header field.

In your theme (with a developer or a child theme):

  1. Copy the snippet as described above.
  2. In your theme, open header.php.
  3. Paste the snippet on a new line just before </head>.
  4. Save the file.

Switch tracking on

In Varly, go to the Install page and click Turn tracking on under 3. Turn tracking on. You can also do this under Settings → Tracking & privacy.

The snippet picks this up within a minute. Then follow Check that Varly is working.

Cart and checkout

By default, Varly never tracks pages that start with /checkout, /cart, /winkelwagen or /afrekenen. These match the standard WooCommerce pages in English and Dutch.

If your cart or checkout page has a different address, for example /basket or /en/checkout, add it under Settings → Tracking & privacy → Never track these pages, one path per line. The list matches the start of the path.

Varly follows the choice visitors make in your cookie banner. It works with CookieScript, Cookiebot and OneTrust, and with banners that send Google Consent Mode signals, such as Complianz, CookieYes and Usercentrics, when Consent Mode is switched on in the banner's settings. See Cookie consent for how to set this up.

Common problems

Data stopped after I changed my theme. If you added the snippet in header.php, it was part of the old theme. Add it again, or switch to the plugin method.

A speed or caching plugin is active. Some of these plugins delay, combine or move scripts. If no data comes in, exclude the Varly script from those options, and clear the cache after adding the snippet.

I see the snippet twice in the page source. Remove one copy. If the snippet is both in a plugin and in your theme, visits are counted twice.

Orders don't show up in Varly. Check under Settings → Varly that the order API key is saved, and look at the order notes in WooCommerce for a message from Varly. Only paid orders are sent; orders that are still Pending payment are not.

Orders show up but aren't linked to visits. The visitor declined cookies, or bought within a few seconds of arriving. See Orders are not linked to visits.

My cart page is called something else. Add its path under Never track these pages, as described above.

Was this article helpful?

Still stuck? Email support@varly.ai and we'll help you out.

Related articles