Go to Qubit

Universal Variable documentation


Universal Variable (UV) is a JavaScript (JSON) object containing details of a web page being viewed, and how the user sees it.

For example, the UV might contain details of the product being viewed (id, price etc), the user details (username, if they are new/returning), or the products that have just been purchased on an ecommerce site.

Note: while the UV is designed around ecommerce businesses, it is equally applicable to other industries including travel, banking, and media.

For example, UV on a product page of an ecommerce site might contain the following data on the product being viewed:

"product": {
  "id": "1234567890",
  "url": "product.html",
  "name": "Sparkly Shoes",
  "description": "Description about this product",
  "manufacturer": "The Shoe Co",
  "category": "Shoe",
  "subcategory": "Heels",
  "currency": "GBP",
  "unit_price": 130,
  "unit_sale_price": 125,
  "sku_code": "1234567890red",
  "stock": 21,
  "voucher": "MYVOUCHER1",
  "color": "Red",
  "size": "M"

How does it work?

The aim of UV is to contain all dynamic data that matters about a page, and make it available to the browser in a standard, structured format. It should contain (but is not limited to) data on:

  • The current page type
  • Product data
  • Items held in a shopping basket
  • Transactional details (e.g. order id)
  • Items shown on search page
Qubit, W3C, and Google have been working closely together with other leading tech companies to standardize this format across the web. UV forms the basis of this standard. Find out more.

What do I have to do?

The UV, namespaced as window.universal_variable, needs to be hardcoded onto your website in the <head>. Parameters within it need to be populated dynamically (e.g. product id, user id).

Note: A full UV setup usually takes 2 days development work, and will save you a significant amount of development time once implemented.

You’ll also need to implement the Opentag container tag, details below.

Container tag

An Opentag container is one line of HTML that points to a JavaScript file hosted on a CDN, and can contain third party technologies. Fundamentally, it is a tag management container, but is also used to deploy all Qubit’s personalization technologies.

You can find your container tag in the Opentag interface. It might look something like this:

  <script src='//d3c3cq33003psk.cloudfront.net/opentag-xxxx-xxxx.js' async defer></script>

This needs to be copy and pasted into the <head> of every page on your website.

Why is UV useful?

View the benefits

Was this helpful?