Using Google Analytics with Shadowbox Galleries

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Google Analytics with Shadowbox Galleries

                <a href="photosforshadowbox/pocketpal/1.jpg" title="Pocket Pal (2 of 9)" rel='shadowbox[PocketPal]' onClick="_gaq.push(['_trackEvent' , 'Pocket Pal' , 'View' , 'Page 2' ]);" >
                                        <a href="photosforshadowbox/pocketpal/2.jpg" title="Pocket Pal (3 of 9)" rel='shadowbox[PocketPal]' onClick="_gaq.push(['_trackEvent' , 'Pocket Pal' , 'View' , 'Page 3' ]);" >
                                        <a href="photosforshadowbox/pocketpal/3.jpg" title="Pocket Pal (4 of 9)" rel='shadowbox[PocketPal]' onClick="_gaq.push(['_trackEvent' , 'Pocket Pal' , 'View' , 'Page 4' ]);" >
       
R Hopper
I have a website that has my portfolio. I have thumbnails to the actual projects and the projects open in Shadowbox.  There are multiple pictures inside each project that load in a shadowbox gallery.  I can track the first click using onClick="_gaq.push(['_trackEvent','title','action','value']);"  however, the rest of the images can't get tracked that way.  Does anyone have any ideas what I could do? Could I change onClick to something else assuming the users are changing pictures using the previous and next arrows in shadowbox? I have also tried onLoad and onChange and neither seemed to work.  I would greatly appreciate any help.

The website is www.juliekarnesdesign.com and below is a little of the code:

<a href="photosforshadowbox/pocketpal/Cover.jpg" title="Pocket Pal Book Jacket Cover (1 of 9)" rel='shadowbox[PocketPal]' onClick="_gaq.push(['_trackEvent' , 'Pocket Pal' , 'View' , 'Cover' ]);" >Pocket Pal Project
Reply | Threaded
Open this post in threaded view
|

Re: Using Google Analytics with Shadowbox Galleries

HenzeBerkheij
in your init options you can do onChange: function () { // do google analytics code here with Shadowbox.current to get the current element: Shadowbox.gallery[Shadowbox.current] and get the values like .content etc }

Reply | Threaded
Open this post in threaded view
|

Re: Using Google Analytics with Shadowbox Galleries

R Hopper
Im very new to this, this is my first website to program and I am an engineer not a computer person so, can you explain what the Shadowbox.current and shadowbox.content is. or do you know where i could read more information on these? are these built into javascript? I would like to see what other options are available.
Reply | Threaded
Open this post in threaded view
|

Re: Using Google Analytics with Shadowbox Galleries

HenzeBerkheij
Shadowbox is a library which puts it's functions in the variable Shadowbox....you can access it's variables by enter Shadowbox.current or Shadowbox.content...the first one contains the number which tells you which element is currently showing...the content variable is the content you want to show (what you fill in at href)

when you do the init you declare the onFinish (better because this executes after finishing loading). like this:

Shadowbox.init({onFinish: function(){ //and here the code for google analytics}
});

basically..when loading a picture in the gallery..the google analytics code is executed for the current image..