views:

46

answers:

2

I am working on a app that uses a json response from my Zend Framework 1.10 website. I want to track how many times the Json Action is hit?

If there is no true way to do this from just the action that is not reflected the json response.

A: 

Hi,

You can track any action with GA by having a special page with tracking code for it that you load into an iframe when the action takes place.

If you need more actions you can have something like trackAction.php?action=myAction.

Regards, Alin

Alin Purcaru
A: 

Hi , I would suppose you are using Jquery to illustrate my idea , I would track both success and error function of jquery using google analytics events

   example :  pageTracker._trackEvent(category, action, opt_label, opt_value );

  Guide : http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html



$.ajax({
......... some jquery code here .....

success:function(){
......... Jquery code ...........
/*lets show some magic */
pageTracker._trackEvent("JSON", "SUCCESS", "Loaded" , 1 );

},
error:function(){
.......... Jquery code ...........
pageTracker._trackEvent("JSON", "FAILD", "why it faild " , 0 );
}
})

at the end of the day , go to Events on you GA Account you would see handy results as you would expect :) you can track ( click , AJAX Request , Page load time , Banner & many other smart ideas )

another tip : you might use what GA Marketers used to do

this is the most easiest one to make http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55578 just append it to your AJAX request and watch the magic :)

Twitter using this idea in the mailing notification example :

http://twitter.com/*********?utm_campaign=newfollow20100823&utm_content=profile&utm_medium=email&utm_source=follow

tawfekov