Skip to main content

Orion - Getting Started ( WordPress )

This is the WordPress guide for getting started with Orion. If you're not using WordPress you can follow the Manual guide instead.

Implementing the Orion Library in WordPress

This guide provides concise steps for implementing the Orion.js library for on-page analytics. Orion.js collects client-side information that is reported in the Spiny app.

Prerequisites

WordPress Plugin Configuration

For WordPress we recommend using the Spiny WordPress Plugin. Please find our getting started guide for our WordPress Plugin here. If you're only leveraging Spiny's Analytics solution you can additionally find the manual configuration guide here if you would like to configure our plugin yourself. We cover a few of the configuration concepts below but for the most part this is handled by the Spiny team or covered in the manual configuration guide.

If you're not looking to include our plugin in your CMS you may be better suited to leverage one of our other getting started guides.

Page Types

The Spiny WordPress plugin will automatically handle setting page type for default WordPress sections such as home, category, article, author, and tag page types.

If you leverage custom WordPress 'pages' for any of the primary page types, have custom pages you would like to track separately, or wish to override our default page types you will need to manually call/update the Orion context. To do this call JavaScript the below code on those page types.

orion.setContext("page.pageType", "<PAGE TYPE DESIGNATION>")

Bundle Generation

The Spiny team will need to generate a bundle based on the various requirements gathered before proceeding. Once we have generated a bundle and provided the url you can begin the next step.

Bundle Reference

Spiny's WordPress plugin will handle rendering the bundle to the page. A member of the Spiny team will ensure the appropriate bundle URL is configured.

Reference Attributes

Since the bundle itself will be rendered by the Spiny WordPress plugin if you have a preference of load(async or defer) attribute you would like to apply simply let our team know and we will make the appropriate configuration change to the WordPress plugin.

note

Leveraging async on a <script src="..."></script> reference will ensure the script is not render blocking. defer delegates the loading of the script to after the page has loaded and all deferred scripts will be loaded in the order they are rendered on the page(we do not recommend this attribute).

Bootstrap Code

The Spiny WordPress plugin will render the necessary bootstrap code for Orion to perform normal operations. If you do leverage additional methods that don't seem to be working as expected in your implementation, please let our team know and we can make the appropriate updates to your plugin code.

Initialization

For a WordPress integration, orion.init(window.spiny.orion.initData) is automatically called on page load from the footer.

For subsequent client-side page views, where client-side JavaScript renders more content or more than one page worth of data on a single server-side call, use the following verbose call when the user begins to scroll the subsequent page into view:

orion.setConfig(newPvConfig);
// or if only updating context:
orion.setContext(newPvContext);

orion.newPageView();

Ensure that setConfig or setContext is called before newPageView.

Config

The configuration controls the behavior of the library. Usually, the static configuration for your site is handled by our team, so you don't need to make many adjustments outside of the context.

Context

Context provides Orion with all the necessary data for proper event attribution. When setting the configuration, you can update context under the top-level context key:

orion.init({
context: implementationContext
});

orion.setConfig({
context: implementationContext
})

For more information about the values that can be passed into context, visit this link.

Third Party Integrations

To ensure complete reporting please be sure to follow the guides under integrations in the sidebar for any third party ad integrations you have.