Issue 343: Track nyromodal with Google Analytics
Status:  Fixed
Owner: ----
Closed:  Oct 2009
Reported by rmuch...@gmail.com, Sep 29, 2009
- one of my websites is registered in google analytics.
- All pages (except the homepage) are seen in windows nyromodal (loaded
with ajax). 
- I have included the analytics tracking code on each page, as Google said.
- But the statistics have fallen to the point that, to avoid problems with
my client, disable all calls to nyromodal. 
- I know that google analytics is tracking problems with ajax applications
(Google provides special directives to follow). However,
Questions
- Nyromodal has some function for Google to tracker pages loaded in their
windows using ajax? 
- Where can I include? 

Thank you very much for your response.

Oct 2, 2009
#1 rmuch...@gmail.com
anyone?
Oct 2, 2009
Project Member #2 nyro...@gmail.com
You could send a manual call using the Analytics API.
To do so, you could do it like:
$.nyroModalSettings({
  endShowContent: function(elts, settings) {
    pageTracker._trackPageview(settings.url);
  }
});

I didn't test it, so don't hesitate to send your feedback please.
Oct 2, 2009
#3 rmuch...@gmail.com
Thanks for your reply. I'll test your suggestion and send you the results soon.
Thanks again.
Oct 13, 2009
Project Member #4 nyro...@gmail.com
Is it finally working for you?

I just added the soltuon on the official wiki:
http://nyromodal.nyrodev.com/wiki/index.php/Track_modal_opening_using_Google_Analytics
Status: Fixed
Oct 13, 2009
#5 rmuch...@gmail.com
Thanks for your solution. I could not test it fully yet, due to adjustments in
general I'm doing in my websites. However, I must congratulate you on your excellent
source, whom I am among my priorities for implementation. If you wish, send me a logo
of your code that will include at the end of my pages with a link to your website. A
simple way of thanking you for your excellent work. Thanks again.
Oct 13, 2009
Project Member #6 nyro...@gmail.com
The logo is available here: http://nyromodal.nyrodev.com/img/nyromodal.gif
I don't have a smaller one, but you can do it I'm sure ;)

thanks for that.
Apr 28, 2010
#7 netmakin...@gmail.com
I tried this solution, but could not get it to work. Where exactly should this code
be placed? You can see how I've implemented it here (near the bottom of the
document): http://nmquote.com
Apr 29, 2010
Project Member #8 nyro...@gmail.com
Are you sure the code wher you placed the nyroModalSettings call is executed?
Are you sure the endShowContent callback is called?
Apr 29, 2010
#9 rmuch...@gmail.com
In the page where you have the popup info put this:
.....
<head>
.....
<script type="text/javascript">
$(function () {
	$('a.nyroModal').nyroModal({bgColor: '#000'});
	$.nyroModalSettings({
	  endShowContent: function(elts, settings) {
	    pageTracker._trackPageview(settings.url);
	  }
	});
});
</script>

<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview();
} catch(err) {}
</script>
</head>

<body>
.....
</body>
</html>

- See where I put the analytics code: in the section head for the call of nyromodal
pageview tracking (which is loaded at the end of the DOM) can be activated. 
- I also put a call to preview tracking below the Analytics code so that when the
page loads outside (regardless of the homepage) can also activate the pageview. 
- In these google analytics page views in the general report content as follows:
- /http://mydomain.com/index.php/namefolder/etc/titlepage

I hope this information will serve.
Best regards