Search the Omeda Knowledge Base

< All Topics
Print

Implementing Omeda’s CDP Solution, Olytics

To implement Omeda’s CDP solution, otherwise known as Olytics, you will need to add JavaScript and CSS to the header of any web page in which you want to capture behavioral data. These scripts will be provided to you during set up and can also be found in the Omeda menu under Integrations and Olytics.

  • Global CSS
  • Global JavaScript load script
  • olytics.fire script

Let’s break down what each of these do in more detail.

Olytics CSS

The Olytics CSS will primarily provide the styling required to use Personalization, Meters, and our Consent Management solution on your sites. NOTE: The source url for the stylesheet will be different for the Staging and Production environments.

Global JavaScript Load Script

This image has an empty alt attribute; its file name is OID-Key-2-1024x612.png
The Global Javascript Load Script in the Olytics Integration Screen

This script will be the driver for creating anonymous users in your database, converting your anonymous users to known, and triggering Personalization and Meters. This script will contain a unique oid key, or Olytics Id, which will be associated to your database. The olytics id, as well as the Global Javascript Load script, for your Production and Staging environments will be different. You can find the Production script by logging into the Production environment, my.omeda.com, and clicking Integrations in the Menu, and then selecting Olytics. You can find the Staging script by logging into the Staging environment, https://my.omedastaging.com/, and doing the same.

This script will create two cookies, the oly_anon_id cookie and the oly_enc_id cookie, and store them in the user’s browser for your site domain.

The oly_anon_id cookie will always be populated in the browser if the olytics.load script is implemented correctly, and will be the id associated with all of a user’s visits to your domain. The value for this cookie is also referred to as the Anonymous Id or the Alternate Id.

The oly_enc_id cookie will be populated for your site users if they have converted to a known customer. This id is their encrypted customer id. If they have not yet converted their traffic to a known customer record, this value will be null.

Let’s explore a few user personas and how these id’s will or will not be populated in their browser:

  • A new site user
    • When this user visits your Olytics site for the first time a new, unique anonymous id will be created for them and will be stored in the oly_anon_id cookie. This customer will be created in your database as an anonymous customer. You can find this customer in your database by pasting this value in the Alternate Id field in Audience Search. The oly_enc_id cookie will be created but the value will be null.
  • A returning anonymous user
    • When this user returns to your Olytics site, if the oly_anon_id is still stored in their browser, the new visit will be associated to their anonymous customer record.
  • An anoymous user who has visited your site by clicking a link with an oly_enc_id parameter OR has completed a form with the olytics.confirm javascript
    • This user’s anonymous customer id will now be attached to a known customer record which will associate all visits to your site made with the oly_anon_id to the known record in your database. The oly_enc_id cookie value will now be populated.
  • A known user
    • This user’s oly_enc_id and oly_anon_id cookie values are stored in their browser and all visits to your Olytics site will be associated to their known customer record.

olytics.fire JavaScript

An example of the olytics.fire script in the Olytics Integration screen

This script will associate the visitor created by the olytics.load script with an Olytics behavior stored in your database. These Olytics behaviors are typically for a single site domain and have a unique behavior id which should be populated in the olytics.fire script. This script is how we determine which Olytics domain your user has visited and when. The behavior can then be used to query on these properties in Audience Builder. Within this script is where you will also pass Omeda attributes about the particular url they have visited like Category or Tag. Custom Olytics attributes can also be used to pass us details about the visit. To create a custom Olytics attribute please create a ticket in the Jira Service Desk.

An example of this script with each Olytics behavior id and the Olytics attributes for your database can be found under Integrations and Olytics within the Omeda portal.

You can choose to populate the Olytics attributes within the olytics.fire script in a couple of ways. You may choose to populate the attributes by manually adding the Category and Tag for each page, or you can choose to populate these values from the metadata of your page.

Adding the Scripts to Your Sites

The css and two JavaScript snippets should be added to your to the head of your sites. Remember the behavior id for each domain will be different and should changed for each domain. Combined, the scripts should look like the below screenshot:

The instructions below outline how these scripts might be added using Google Tag Manager or WordPress.

Adding Olytics to Your WordPress Sites

  1. Go to Settings
  2. Select Per Page Add to Head
  3. Paste in your Olytics script

Adding Olytics to you Sites using Google Tag Manager

In Google Tag Manager, navigate to the container associated to the domain you want to add Olytics to. This step will be repeated for every domain.

  1. Select the site domain container
  2. Select Tag, then select New in the upper right corner.
  3. Click on Tag Configuration and select Custom HTML
  4. Paste in your Olytics script
  5. Click on Trigger and add trigger by choosing the + button on the upper right. You can select All Pages (default) or create a custom trigger if you only want to trigger Olytics to fire on certain pages.

Using Metadata to Populate Your Olytics Attributes

Rather than managing the Olytics attributes for each page, you may choose to leverage the existing metadata on your sites to populate the Olytics attributes. To do so, you’ll need observe how your metadata is stored and which values should be passed each Olytics attribute.

Adding Category and Tag values your post using WordPress.

  1. Go to any of your post or articles
  2. At the bottom of your post, there is a section called “Add to head”.
  3. Insert meta names olyticsCategory and olyticsTag (see below) to the head of your post or article.
  4. Add values e.g. (blog, post, widgets, marketing etc.)
    Important note – you will need to use a comma between values if there is more than one value you want to record for each meta name.

    <meta name=”olyticsCategory” content=”Insert a value here” />
    <meta name=”olyticsTag” content=”insert in a value here” />
*Important Note: 
1. Search for INSERT YOUR OID KEY and replace with your OID Key. Also known as Olytics Connection Key. 
2. Search for encrypted-behavior-id and replace with the behaviorId related to your site. 

If you do not know them, please reach out to Client Success.

Custom Olytics Script:

<script type="text/javascript">

// olytics 3.0

window.olytics||(window.olytics=[]),window.olytics.methods=["fire","confirm"],window.olytics.factory=function(i){return function(){var t=Array.prototype.slice.call(arguments);return t.unshift(i),window.olytics.push(t),window.olytics}};for(var i=0;i<window.olytics.methods.length;i++){var method=window.olytics.methods[i];window.olytics[method]=window.olytics.factory(method)}olytics.load=function(i){if(!document.getElementById("olyticsImport")){window.a=window.olytics;var t=document.createElement("script");t.async=!0,t.id="olyticsImport",t.type="text/javascript";var o="";void 0!==i&&void 0!==i.oid&&(o=i.oid),t.setAttribute("data-oid",o),t.src="https://olytics.omeda.com/olytics/js/v3/p/olytics.min.js",t.addEventListener("load",function(t){for(olytics.initialize({Olytics:i});window.a.length>0;){var o=window.a.shift(),s=o.shift();olytics[s]&&olytics[s].apply(olytics,o)}},!1);var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)}},olytics.load({oid:"INSERT YOUR OID KEY"});

</script>

<!-- Olytics Global Script for Category and Tag Meta - Added by MJM 10-28-15 -->

<script>
var metas = document.getElementsByTagName('meta');
var olyticsTag = "";
var olyticsCategory = "";


// First we see if the page has any html meta tags
if(metas && metas.length > 0) { 

    // loop through the meta tags
    for(var oolltt = 0; oolltt < metas.length; oolltt++) {
        var oollttMeta = metas[oolltt];
        var theNameAttribute = oollttMeta.getAttribute('name');
       
        // is the meta tag an 'olyticsCategory' meta tag ?
        if(theNameAttribute && theNameAttribute == 'olyticsCategory' && oollttMeta.getAttribute('content')) {
            // the meta tag is an 'olyticsCategory' meta tag - lets grab the content of the tag to use in the analytics.track call.
            olyticsCategory = oollttMeta.getAttribute('content');
            
        // is the meta tag an 'olyticsTag' meta tag ?
        } else if(theNameAttribute && theNameAttribute == 'olyticsTag' && oollttMeta.getAttribute('content')) {
            // the meta tag is an 'olyticsTag' meta tag - lets grab the content of the meta tag to use in the analytics.track call.
            olyticsTag = oollttMeta.getAttribute('content');
        }
    }

    if(olyticsCategory.length > 0 || olyticsTag.length > 0) {
    
        // so at this point we have either an olyticsCategory and / or olyticsTag to pass in the analytics.track call.
        
        //fire the olytics.track call
        olytics.fire(

  {	

                behaviorId: 'encrypted-behavior-id',

                category: olyticsCategory,

                tag: olyticsTag

  }

)
} else {
		 olytics.fire(
			{
				behaviorId: 'encrypted-behavior-id'
			}
		);
	}
}
</script>

<link rel="stylesheet" href="https://olytics.omeda.com/olytics/css/v3/p/olytics.css" />
Table of Contents
Scroll to Top