jQuery(document).ajaxComplete(function(e, xhr, settings){
var d = document.location.pathname + document.location.search + document.location.hash;
_gaq.push(['_trackPageview', d]);
});
Source: http://stackoverflow.com/questions/7737549/google-analytics-and-loading-a-page-using-ajax-get-request
Showing posts with label ajax. Show all posts
Showing posts with label ajax. Show all posts
Friday, November 16, 2012
Add AJAX Request to Google Analytics
If you use jQuery you can bind to the global AjaxComplete event to fire a Pageview everytime an Ajax call completes:
Wednesday, August 4, 2010
JSON Response in Symfony
If you want an action returns with json data, create something like this:
public function executeJson(sfWebRequest $request)
{
$this->getResponse()->setContentType('application/json');
// create the data
$data = "something";
return $this->renderText(json_encode($data));
}
Subscribe to:
Posts (Atom)