Open sferoze opened 8 years ago
@sferoze I understand your confusion and I agree their docs aren't the most straight forward. There isn't an npm package that I'm aware of that handles implementing Omniture on the front end. This is mainly because it's a fairly custom process and a framework or package wouldn't do much for you.
Using this https://marketing.adobe.com/resources/help/en_US/sc/implement/appmeasure_mjs_pagecode.html as a guide, I'll walk you through a couple steps to get started.
You should be able to download or have been given a file called AppMeasurement.js
or sometimes called s_code.js
if your working with someone who signed up for Adobe Analytics (previously Omniture and SiteCatalyst) a while ago. This file is the main library that has all of functions you'll need to track your pages.
The only thing you'll need to edit is the s_account
variable at the top and the s.trackingServer
and s.trackignServerSecure
You'll want to ask your Adobe Analytics rep where to that information.
The AppMeasurement.js
file adds a global variable to your page called s
. The s
object is where you'll set page specific values and where you'll call the s.t()
function with sends all the information to Omniture.
There are 4 main types of properties I use when tracking: eVars
, events
, campaign
, and pageName
. There are also props
, and channels
, but to be completely honest, I'm not sure how those are used, so I won't touch on them. eVars and events need to be set up one by one in the Omniture admin.
eVars have a number appended to the end so you would have s.eVar1
or s.eVar1
all the way up to 100 (I believe). eVars hold a string value. This can be what ever you'd like it to be.
A simple example would be storing the location of where a user signed up for your newsletter. Would set something like this:
s.eVar1 = 'footer';
The next property, events are usually incrementors. They keep track of how many times a thing happened. Like eVars, events have a number appended to them. (event1
, event2
). You set events on the s.events
property as a comma delimited string: s.events = 'event1,event2'
.
We could use an event to track how many times users have signed up for our newsletter.
s.eVar1 = 'footer';
s.event = 'event1';
the s.campaign
property is used to track how users got to your site. This usually pulled from a parameter in your url. Say you shared a link on Facebook http://www.yoursite.com?source=newsletterSignupPost
. In your javascript on your site you would grab that url parameter and set the campaign variable to that value:
var sourceParam = getUrlParam('source'); // some function you write to get url parameters
s.campaign = sourceParam;
This will let you track how many users came to your site from that link.
The last one is s.pageName
this sets what type of page your are tracking. Your home page would most likely be:
s.pageName = 'home';
Or if your an ecommerce site and you may have s.pageName
set to product
or category
or cart
.
As a final example let's put it all together. An example user comes to the site and signs up for the newsletter in the footer on your homepage. You would have something like the following code:
var sourceParam = getUrlParam('source'); // some function that gets url parameters
s.campaign = sourceParam;
s.pageName = 'home';
s.eVar1 = 'footer';
s.events = 'event1';
s.t();
The s.t()
function is what sends all the information to Omniture. It takes all of the data that was set and puts them into a big long url and injects an image pixel on to the page which sends all of the info to Omniture.
This is a fairly simple example but it should be enough to get your feet wet. If you have an ecommerce site there are a few other properties that you'll want to set on product and checkout pages.
One last thing to note, if your in Omniture looking at reports. eVars
map to 'Conversion Variables' and events map to 'Success Events'
Hopefully that gets you going in the right direction.
@imartingraham woww thanks soo much! Our client really wants us to use Omniture or Adobe Analytics and I was tearing my hair out trying to figure out how to use this thing. Your post is a great quick start example. I hope others in need are able to find this post. Thanks again.
Hello,
I am really confused by this and other omniture npm libraries.
Omniture is a competitor to Google Analytics correct?
So far it seems like they are geared around getting reports from Omniture.
But how do you setup your app in the first place to report events and page views to Omniture.
No npm package shows how to do this, and their docs are terrible. What's going on? Can I use this npm package to setup Analytics reporting to Omniture?