Versioning & Upgrade guide

Learn more about our version support policy and the steps you need to take to upgrade your app to the latest Tracking Code version.

When backwards-incompatible changes are made to the Tracking Code, we release a new version. The current version is 5. For information on all updates, view our upgrade guide below.

Upgrading from version 1 or 2

Replace the Tracking Code

Replace the current Tracking Code (the file ends on openpixel.min.js) by the new version Tracking Code.

  1. Go to Settings → Event tracking.
  2. Click Copy code to get a ready-to-use Prepr tracking code and add it to the <head> section of your website.

If a Tracking Code isn't available in your dashboard, you can use the following code along with the current access token:

<!-- Prepr Tracking Code -->
<script>
    ! function (e, t, p, r, n, a, s) {
    e[r] || ((n = e[r] = function () {
    n.process ? n.process.apply(n, arguments) : n.queue.push(arguments)
    }).queue = [], n.t = +new Date, (a = t.createElement(p)).async = 1, a.src = "https://cdn.tracking.prepr.io/js/prepr_v2.min.js?t=" + 864e5 * Math.ceil(new Date / 864e5), (s = t.getElementsByTagName(p)[0]).parentNode.insertBefore(a, s))
    }(window, document, "script", "prepr"), prepr("init", "{REPLACE_ACCESS_TOKEN}"), prepr("event", "pageload");
</script>

Sending manual events

In version 1 or 2 events are sent by using the opix command, like this example below:

opix('event', 'View', {"publication":"{{CONTENT_ITEM_ID}}"});

The new version listens to the prepr command, you should update all event tracking requests to the following format:

prepr('event', 'View', { 'id': "{{CONTENT_ITEM_ID}}" });

In the new Tracking Code, page view tracking can be added easier by using the meta-data keys; read more on this topic in the data collection guide.

Upgrading from version 3

Replace the Tracking Code

Replace the current Tracking Code (the file ends on prepr.min.js) by the new version Tracking Code.

  1. Go to Settings → Event tracking.
  2. Click Copy code to get a ready-to-use Prepr tracking code and add it to the <head> section of your website.

If a Tracking Code isn't available in your dashboard, you can use the following code along with the current access token:

<!-- Prepr Tracking Code -->
<script>
    ! function (e, t, p, r, n, a, s) {
    e[r] || ((n = e[r] = function () {
    n.process ? n.process.apply(n, arguments) : n.queue.push(arguments)
    }).queue = [], n.t = +new Date, (a = t.createElement(p)).async = 1, a.src = "https://cdn.tracking.prepr.io/js/prepr_v2.min.js?t=" + 864e5 * Math.ceil(new Date / 864e5), (s = t.getElementsByTagName(p)[0]).parentNode.insertBefore(a, s))
    }(window, document, "script", "prepr"), prepr("init", "{REPLACE_ACCESS_TOKEN}"), prepr("event", "pageload");
</script>

Automatic Page View Tracking for Client-Side Routing Frameworks

In version 3, page views (View events) are not automatically tracked if you're using client-side routing frameworks like Next.js or Nuxt.js. You had to manually trigger page view events after a route change. In the latest version, page views are now automatically tracked by default, even with client-side routing. If you have custom code to trigger page views after a route, it can be safely removed.

Was this article helpful?

We’d love to learn from your feedback