Click to Play

Search Marketing Evolution
As search has developed, the end user has also undergone behavioral changes. Universal and blended search have played a lead role in the user’s changes. Many...

Web News

The Importance Of Section Targeting
Using Adsense on your blog usually isn't the most profitable way to monetize it, but it is fairly quick and easy, which makes it a popular choice for many website owners. Last week I moved one of my commercial...

Stopping Redirects From Being Compromised By...
Late last week the Google Webmaster Central Blog discussed site redirects and how they can be potentially compromised by spammers. They also mentioned 7 ways in which you can prevent your site redirects from...

Increase Site Searchability By Adding Videos
The Forrester Blog recently came up with an interesting info on how to heighten page rankings on Google! Their main tip is to utilize Google's universal search by...

What Are The Development Tools Of 2009?
I remember the good old days of 1994. Back when your only choice of developing a web site was doing it by hand. Remember typing HTML codes like b and table and making it all work? Or, if you didn't know what those...


03.16.09

Requesting Data From The Omniture API

By Gary Angel

In my next post, I'm going to dive down and talk in more detail how the API actually works and show pieces of a real application. But before I go there, I wanted to touch one more time on tokens and give any programmers out there a heads-up on the "Great Token Gotcha."

In my last post, I described Omniture's token system - the basic metering systems that controls how many API requests you can make and how they cost. In essence, each API request you make costs you a token. And to use the reporting API, you have to submit a request and then you have to get the report. So you typically use two tokens per request.

Simple?

It is, but there is a big gotcha out there.

Here's how it works.

To make a request to the API, you build up a report object that tells Omniture what data you want to retrieve and what time period you are looking for. When you've defined everything, you submit your report.

So far so good.

Now here comes the tricky part. Most Omniture Sample code works the same way. After the request is submitted, you go into a wait loop. You pause your program for a second or two, request the report object to see if it's finished. If it's done, you are good to go. If it's not done, you wait for another second or two and check again.

The Premier Event for Search Engine
Marketing & Optimization -
Register Now

Here's some heavily commented code (this whole post is really for programmers so feel free to skip if your interest in the API is more on the business site):

//request the report
reportQueueResponse response = glob.ws.ReportQueueRanked(rd);

// Wait for 1000 milliseconds or 1 second
System.Threading.Thread.Sleep(1000);

// Grab report
reportResponse reportR = glob.ws.ReportGetReport(response.reportID);


// If the report is not ready then wait and check to see if it is ready
while (reportR.status != "done")
{
// Wait another second
            System.Threading.Thread.Sleep(1000);
// Check the report again
      reportR = glob.ws.ReportGetReport(response.reportID)

// Keep checking (go back to the while until the reportR.status is done
}

This is a simple, obvious way to manage your code. There are others, but this is the way most of the Omniture examples on their dev site are built and it makes perfect sense.

It's also terribly wrong and the reason isn't programmatic. What is hidden in the system is that Omniture will dock you a token for each and every time you make the:

Continue reading this article.


About the Author:
Gary Angel is the author of the "SEMAngel blog - Web Analytics and Search Engine Marketing practices and perspectives from a 10-year experienced guru.
About DevWebProDK

DevWebProDK is for professional developers ... those who build and manage applications and sophisticated websites. DevWebProDK delivers via news and expert advice New Strategies In Development.





DevWebProDK is brought to you by:

SecurityConfig.com NetworkingFiles.com
ITmanagementNews.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagementNews.com






-- DevWebProDK is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
 © 2009 iEntry Inc.  All Rights Reserved  Privacy Policy  Legal 

advertising info | news headlines | free newsletters | comments/feedback | submit article