View Full Version : Lightroom Galleries and Google Analytics
DDCSD
6th of April 2009 (Mon), 16:36
Is it possible to use Google Analytics with a Lightroom created web gallery, either flash of HTML?
brecklundin
6th of April 2009 (Mon), 16:50
I am assuming you are asking about the default templates included with LR. As far as I can tell from a fast look all you need to do is add the Google code to the appropriate index.html page for any of the prebuilt files found in each subdirectory this directory:
C:\Program Files\Adobe\Adobe Photoshop Lightroom 1.4\shared\webengines
The location will be different on a Mac but you will see the idea. It should be pretty straight forward.
DDCSD
6th of April 2009 (Mon), 16:53
Hmmm..... that makes entirely too much sense. :) I'll have to play around with it tonight.
Thanks!
brecklundin
6th of April 2009 (Mon), 17:17
hehehe...sure you bet. It will be interesting to see what you figure out. Playing with those files is on my "to try" list but, you know how THAT list can be...now serving #4 and I am holding #437892301 (sorry just a vague reference to Beettlejuice.)
DDCSD
6th of April 2009 (Mon), 20:20
Well, that didn't work. I inserted it in the index file, saved it and re-uploaded it and now the page doesn't work at all.
brecklundin
6th of April 2009 (Mon), 21:21
where did you add the code? If there isn't anyone out there who has done this I have some time and might be able to take a look at the code to see if I can help. If ya don't want to post it here just PM me and attach the source code...??
brecklundin
6th of April 2009 (Mon), 21:23
hey did you take a look at the tutorials and examples here:
http://www.lightroomgalleries.com/tutorials/
??
DDCSD
6th of April 2009 (Mon), 21:24
where did you add the code? If there isn't anyone out there who has done this I have some time and might be able to take a look at the code to see if I can help. If ya don't want to post it here just PM me and attach the source code...??
I put it in the index page, right before the last /body tag. I'm trying one other thing here (putting it in the webengine index file like you originally stated to do). Right now I'm generating a new gallery, so I'll see if that worked.
I'm doing it in the flash site, so that may be my problem.
I'm sure it would work just fine in the HTML foot section.
I know just barely enough about this to really screw some stuff up. :lol:
brecklundin
6th of April 2009 (Mon), 21:32
hahahaha....I am rusty enough to do exactly the same thing. I'll keep an eye out here to see what happens. In the mean time I am reading up on the Google metrics code.
brecklundin
6th of April 2009 (Mon), 21:34
here is a good example of what you want to do...it seems the guy is using LR2 so not sure which version you have...I am still on 1.4:
http://automagisk.no/blog/2009/04/01/adding-google-analytics-to-lightroom-web-template/
DDCSD
6th of April 2009 (Mon), 21:44
here is a good example of what you want to do...it seems the guy is using LR2 so not sure which version you have...I am still on 1.4:
http://automagisk.no/blog/2009/04/01/adding-google-analytics-to-lightroom-web-template/
Yeah, I saw that. They are adding it to the HTML foot though. I'm now trying to get it to work in the flash gallery.
The good news is, I seem to have gotten it to work by putting it in the flash template index file and re-exporting/uploading it. Basically what you said to do in the first place. :lol:
I have no idea if its tracking though.
Mind clicking in and clicking around quick to see if it will track you?
http://gallery.cecilphoto.com/shinedown/index
brecklundin
6th of April 2009 (Mon), 21:46
here is what I did as a test using the example on the link above. I made this change to the file here:
C:\Program Files\Adobe\Adobe Photoshop Lightroom 1.4\shared\webengines\default_flash.lrwebengine/index.html
</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<!--BEGIN Google Analytics Code here-->
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("INSERT YOUR GOOGLE ANALYTICS ID HERE");
pageTracker._trackPageview();
} catch(err) {}</script>
<!-- END GA CODE HERE -->
<noscript>
<!-- Provide alternate content for browsers that do not support scripting
or for those that have scripting disabled. -->
<p>
Sorry, this photo gallery requires that scripting be enabled on your web browser and that the Adobe Flash Player be installed.
<a href="http://www.adobe.com/go/getflash/">Download the Adobe Flash Player</a>
</p>
</noscript>
</body>
</html>
everything seems to run fine I have no way to verify the GA code is actually working but that is where it should be put in the file.
For the HTML templates I would put it in the FOOT.HTML file as the tutorial indicates.
monty28428
6th of April 2009 (Mon), 21:47
Just clicked away... Ozzy wannabees ???
brecklundin
6th of April 2009 (Mon), 21:49
que?
EDIT: Oh I get it...he left of the file extension here is the correct link:
http://gallery.cecilphoto.com/shinedown/index.html
DDCSD
6th of April 2009 (Mon), 21:55
Just clicked away... Ozzy wannabees ???
They're actually pretty good, they don't sound anywhere near what they look like. If that makes any sense. Some of their stuff is a little on the harder side, but they've got a strong southern Skynard influence.
here is what I did as a test using the example on the link above. I made this change to the file here:
C:\Program Files\Adobe\Adobe Photoshop Lightroom 1.4\shared\webengines\default_flash.lrwebengine/index.html
everything seems to run fine I have no way to verify the GA code is actually working but that is where it should be put in the file.
For the HTML templates I would put it in the FOOT.HTML file as the tutorial indicates.
I actually inserted it between the last /noscript and /body tags this time. I guess we'll see if it works or not!
que?
EDIT: Oh I get it...he left of the file extension here is the correct link:
http://gallery.cecilphoto.com/shinedown/index.html
Hmmm.... it worked without the .html for me. Didn't even notice it until you pointed it out.
monty28428
6th of April 2009 (Mon), 21:57
LOL -- It worked for me too Derek... Just ignore me -- like everybody else...
Just meant I clicked through the photos.
tomd
6th of April 2009 (Mon), 22:00
Derek,
It sometimes takes Google analytics 24 hours to "find" the code and for analytics to start tracking.
brecklundin
6th of April 2009 (Mon), 22:00
weird...might something with my IE8...it's MS so it's still a beta even after release...sad but true I suppose. ;)
BTW, the code should be fine as long as it is outside the <noscipt>...</noscript> tags and before the </body> tag...one thing though is it won't track each image using Flash. Only the index.html page will be tracked. You would need access to some other code inside the Flash portion of the gallery. However your server analytics should allow you to follow which images get the most attention.
DDCSD
6th of April 2009 (Mon), 22:02
LOL -- It worked for me too Derek... Just ignore me -- like everybody else...
Just meant I clicked through the photos.
I know! He does certainly have the Ozzy look down though!
Derek,
It sometimes takes Google analytics 24 hours to "find" the code and for analytics to start tracking.
Thanks for the reminder! I can stop clicking refresh now. :p
DDCSD
6th of April 2009 (Mon), 22:04
weird...might something with my IE8...it's MS so it's still a beta even after release...sad but true I suppose. ;)
BTW, the code should be fine as long as it is outside the <noscipt>...</noscript> tags and before the </body> tag...one thing though is it won't track each image using Flash. Only the index.html page will be tracked. You would need access to some other code inside the Flash portion of the gallery. However your server analytics should allow you to follow which images get the most attention.
I just tried IE7 and it worked there. Hopefully it works with whatever the band's management uses... Maybe I'll send him another link if I don't hear from him sometime soon...
Good point on the not tracking images thing, I hadn't thought of that. I guess I'm not that terribly worried about that part, more want to know who stops by.
brecklundin
6th of April 2009 (Mon), 22:05
Thanks for the reminder! I can stop clicking refresh now. :p
hahahaha...kinda like watching an auction end...you simply can't look away, you have to keep checking it!! :D
It would be cool to find out how this works for ya. I have not messed around with GA before so not sure what does what...it's all gotten way too complicated my by old brain to track anymore. The parts of it that are still online anyway...cuz it's not the years, it's the miles that matter... ;)
brecklundin
6th of April 2009 (Mon), 22:06
I just tried IE7 and it worked there. Hopefully it works with whatever the band's management uses... Maybe I'll send him another link if I don't hear from him sometime soon...
Good point on the not tracking images thing, I hadn't thought of that. I guess I'm not that terribly worried about that part, more want to know who stops by.
cool...btw, at first I thought the guys looked more like a Meatloaf on Jenny Craig kinda guy...but Ozzy wanna be is a much better tag.
monty28428
6th of April 2009 (Mon), 22:09
Yes - Meatloaf would have been my second guess!
DDCSD
6th of April 2009 (Mon), 23:47
Well, I was wrong, it didn't take. I just looked for the GA code in the index page and it wasn't there. I just assumed it loaded it from the template.
I then tried to insert it after-the-fact and it screwed it up again.
Maybe you just can't do it with the flash templates. Or at least I'm not smart enough to do it.
brecklundin
7th of April 2009 (Tue), 00:45
well, DUH...I am an idiot...just edit the page AFTER exporting it and add in the GA code...sometimes I make this stuff a lot more difficult than it need be, especially if you just want to get something done and out the door.
Seriously this will work now...export to your website, then open the index.html file locally, paste in the GA code, save the file and send it back to the site via FTP and viola it's done. ou will, however have to manually re-add the code after any gallery update as the update will overwrite the modified file.
Don't hate me for being dense...and slow... ;)
BTW, I KNOW this is a brute force and awkwardness method of getting it done, but hey, that works too ya know? :D
EDIT: I just want to add...this is for using the Flash web gallery templates. For the HTML gallery you just need to modify the foot.html page with the GA code and save it. Remember though for each gallery you might want to then save that all as a custom template or they will all use the same GA code. If you don't use different custom templates then you may just as well manually edit each HTML gallery after uploading just like with the Flash templates.
DDCSD
7th of April 2009 (Tue), 08:38
well, DUH...I am an idiot...just edit the page AFTER exporting it and add in the GA code...sometimes I make this stuff a lot more difficult than it need be, especially if you just want to get something done and out the door.
Seriously this will work now...export to your website, then open the index.html file locally, paste in the GA code, save the file and send it back to the site via FTP and viola it's done. ou will, however have to manually re-add the code after any gallery update as the update will overwrite the modified file.
I tried that a few times and it kills the webpage. :cry: It won't load after I do that.
brecklundin
7th of April 2009 (Tue), 08:50
I tried that a few times and it kills the webpage. :cry: It won't load after I do that.
I had to wake up to take my AM "drugs" gimme a minute and I want to try something to see if it works...just a quick test it will take maybe 10 mins. (I hope cuz I needs my beauty sleep... ;) )
brecklundin
7th of April 2009 (Tue), 09:09
OK, I did a fast and dirty test using the GA scripting code from a test site and it works fine if added after the fact. See here:
http://brecklundin.com/test/lrgallery/justin/index.html
Just view the source and go near the end or search for BEGIN GOOGLE to fine the comments demarking the inserted code.
How have you been editing the file after uploading it to your server? For me the process is:
1. Upload gallery to web site
2. FTP connect to site (I use FileZilla cuz it's donationware/freeware and just works), find gallery and index.html for that gallery;
3. Bring that page BACK to my computer and stuff it somewhere convenient;
4. Open the file in an HTML editor (I use MS Visual Studio but any HTML editor will be fine, heck even Notepad will work);
5. Past in the GA code;
6. Save the file;
7. Switch to my FTP program and send the modified file BACK to the server and overwrite the old index.html.
That is it in a nut shell. I hope I did not make it too basic there but I am unsure what you have been doing exactly. I wanted to make sure it worked from my end. And, oh, don't load that page too many times since it has a code that is not mine. In fact, never mind I am just going to use a fake code so the GA script really does nothing but will not raise an exception in your browser, I hope. ;)
EDIT: BTW, those are NOT my photos but my friend too them of her son and I can do whatever with them...he is a real camera hog already, leetle bugger!! But those shots are not my fault...hahahaha....
brecklundin
7th of April 2009 (Tue), 09:13
I am back off to sleep (I was up until almost 4AM so kinda best if I sleep an hour or twenty more... :lol:)
DDCSD
7th of April 2009 (Tue), 09:14
That's exactly what I was doing. Maybe it's Komposer that is screwing it up. I would insert it at the bottom and I would find it somewhere in the middle after I saved it. I think I'll just try doing it it Notepad tonight when I get home.
Thanks again for all the help!
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.