particleandparcel
particleandparcel

Reputation: 23

Suppress Omniture s.t() call from generating a pageview

I have a project that has the standard, borderline unreadable Omniture JavaScript tracking code in it that is below.

<script language="JavaScript">
    var s_account = "{MY ACCOUNT}";
</script>
<!-- START OMNITURE -->
<!-- SiteCatalyst code version: H.1.
Copyright 1997-2005 Omniture, Inc. More info available at
http://www.omniture.com -->
<script type="text/javascript" src="http://MYDOMAIN.com/javascripts/metrics/s_code_trb.js"></script>
<script language="JavaScript">

    s.pageName="Project name"   
    s.server="MYDOMAIN.com" 
    s.prop38="3rd Party";
    s.eVar21="3rd Party";    


/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code=s.t();if(s_code)document.write(s_code) 
</script>
<!--/DO NOT REMOVE/-->
<!-- End SiteCatalyst code version: H.1. -->
<!-- END Omniture code -->

However, this code always generates a pageview.

This project needs to be iframed into our CMS, which means that the container page in the CMS has already generated a pageview. We want to be able to track clicks within the project (e.g. a click on a particular button) but right now, this results in duplicate pageviews, one for the CMS page and one for the page inside the iframe.

Adobe documentation says that s.t() must always be called before s.tl() but vaguely hints that s.t() can be modified so that instead of generating a pageview, it generates a tracking link.

A quick Googling turned up this almost incomprehensible Twitter conversation that seems to hint at the solution to send as parameters pev1, pev2 and pe=lnk_o. But that is still beyond my understanding.

Is this true? Any Omniture gurus out there who can help me figure out how I would do this?

Upvotes: 2

Views: 6989

Answers (4)

Gigazelle
Gigazelle

Reputation: 1399

If you only want to track custom links, and never ever track page views, scrap that entire code block except for the call to the s_code.js file. Then in the links that you want to track, use this skeleton:

<a href="link.html" onClick="
    var s=s_gi('rsid');
    s.tl(this,'o','Custom Link Name');">
Click this link</a>

In the above example, that will send a custom link to the report suite rsid and populate the custom links report with the value Custom Link Name. Be sure to change rsid to the actual report suite you intend to send data to.

The s.tl function's parameters are as follows:

  • First parameter: holds values of either this or true. this gives the page a 500ms delay before proceeding so the image request has a chance to fire, while true disables that 500ms delay.
  • Second parameter: can be 'd', 'e', or 'o'. They are used for download links, exit links, or custom links respectively.
  • Third parameter: the value you'd like to populate in reporting, generally a description of the link they clicked on.

There are several additional variables you can define to enable tracking of props, eVars, and events. If you have access to SiteCatalyst, all of it is contained within the Link Tracking White Paper:

http://microsite.omniture.com/t2/help/en_US/whitepapers/link_tracking/index.html

Also, if you provide me with the source of where it says s.t() has to be called before s.tl(), I can most likely make arrangements to have that corrected.

Upvotes: 1

james emanon
james emanon

Reputation: 11807

Well, I have NO idea how your system is set up, but you might be able to test against your previous pagename and the current one. I am assuming the parent page and the one brought in via iframe have the same pageName - else they are two seperate pages... etc... if not, you can modify this..

around that code you can do something like.

s.prevPage=s.getPreviousValue(s.pageName,'gpv1','');
var s_code=s.t();
if(s.prevPage != s.pageName){
    if(s_code)document.write(s_code)
}

Upvotes: 0

VaBeachKevin
VaBeachKevin

Reputation: 264

You don't need to call s.t() before you call s.tl(). Loading the s_code.js file and then calling the s.t() function will generate a page view as you have seen, but you can just as easily load the s_code.js file and only call s.tl() from onclicks in the links you need to track.

Upvotes: 3

JamesOR
JamesOR

Reputation: 1168

If you are using an iframe and you are on the same domain you can have the iframe doc call the javascript functions on the parent document so it doesn't need to initialize omniture all over again. I have done this with a Backbone app iframed into a page on the same domain.

Upvotes: 0

Related Questions