The Turning Gate

Adobe Lightroom Web Engines, Tutorials and Resources

New Google Analytics, Custom CSS and Custom Javascript implementations in TTG Pages 3.4

by theturninggate on January 17, 2010

TTG Pages 3.4 is now available. With any luck, this will be the last update to this one for a while, because I do have other projects I’d like to spend time on. This update brings several new features and revisions, a few new styling options, and some bug fixes.

One big change is the engine’s handling of Google Analytics. You no longer need to copy and paste a large chunk of Javascript to get Analytics working on your pages; just enter your Web Property ID into the Output Settings pane, as pictured. Your Web Property ID can be found in your Google Analytics overview.

Google Analytics options in TTG Pages

Because extra Javascript — such as the despised right-click disabling script — can no longer be cheated into the Google Analytics area, I’ve created the new Advanced Options control group in the Output Settings control pane. This new control group allows much more than the previous cheating allowed.

The new Advanced Options control group.

To use the script for disabling right-click, for example, you would copy the code and paste it into the Add script before </body> field.

Another exciting feature, for those who understand its use, it the Add CSS rules in <head> input field. Using this field, users can write their own CSS overrides. Be sure to use the !important CSS modifier to override styling commands already in the gallery. To enable new styling possibilities, I’ve also added a #wrapper div that encompasses the page elements. To see this in action, copy the following code into the Add CSS rules in <head> field.

For Marc Labro and Frank Noort:

<style type="text/css">

body {
	background-color: #000000 !important;
	margin: 0 !important; }

#wrapper {
	width: 980px;
	margin: 0 auto !important;
	padding-bottom: 1px !important;
	background-color: #333333;
	height: 100%;
	border-right: 4px solid #787878;
	border-left: 4px solid #787878; }

</style>

The complete list of changes:

v3.4 ( 2010-01-17 )
New border-bottom options for the header/identity plate.
New text-decoration options for Hyperlinks and Menu Links.
Bug fix to galleryindex.php.
Hyperlink target for the “Home” menu item can now be changed; not a feature most people will need to use, but could have some applications for advanced manipulations of your pages.
Changed handling of Google Analytics. Now requires only your Web Property ID (UA-xxxxxx-x), rather than the entire block of Javascript.
Because scripts can no longer be cheated into the Google Analytics entry field as before, I’ve added a new Advanced Options control group to the Output Settings control pane. There are three input fields: Add CSS rules in <head>, Add script to <head> and Add script before </body>. CSS rules are visible in preview, while the scripts are only added when the gallery is published (exported, or previewed in browser) to prevent any possible Lightroom tantrums.
Added a new #wrapper DIV to the source code that allows for new custom styling possibilities.
Source code for Lightroom’s preview onclick events now prevented from exporting, resulting in cleaner code that IE8 should no longer bitch about.

{ 14 comments… read them below or add one }

Markus January 18, 2010 at 1:13 pm

Hi!

I upgraded to the new TTG Pages 3.4 and tried using the new method embedding Google Analytics. I activated “Use Google Analytics” and put my UA-xxxxxxxx-x code into the field.

But when I check my Analytics Account, it always says “tracking not installed”.

Is there any trick to make it work?

Thank you!

Reply

theturninggate January 18, 2010 at 2:12 pm

Hi Markus,

I just setup a new test domain and a new Google Analytics profile to double-check Google Analytics implementation in TTG Pages 3.4, and everything worked fine. Google Analytics did not detect the code immediately, though. I had to wait a little while; but it worked. Make sure your Web Property ID has been entered correctly, and give your site 24 hours. Check back with me after that time to let me know whether things are working.

Matt

Reply

Markus January 18, 2010 at 2:15 pm

All right. I’ll wait until tomorrow. Thanks.

Reply

labro January 18, 2010 at 1:57 pm

thanks matt

marc

Reply

Michael Junge January 30, 2010 at 2:29 pm

Matt – thanks for pointing me here. I’m trying to put a background image on the pages in TTG Pages.

I upgraded to 3.4 (first issue) and then placed the following code ” body { background-image: url(www.feelprettyfotos.com/resources/images/background.jpg) !important; } ” in the “Add CSS rules in (didn’t work) and in the “Add script before (didn’t work)…what am I missing?

Reply

theturninggate January 30, 2010 at 2:53 pm

If you look closely at my sample code above, you will see that it is necessary to include <style type="text/css"> and </style> along with your CSS.

Alternatively, you could write your custom CSS to a new CSS file, add it to the .lrwebengine package, and then write a <link>to include it.

Reply

Michael Junge January 30, 2010 at 4:17 pm

Think I got it now…

used this:

body {
background-color: #6C5C4C;
background-image: url(“http://www.feelprettyfotos.com/resources/images/background.jpg”);
background-repeat: no-repeat;
background-attachment: fixed;
}

Reply

theturninggate January 30, 2010 at 4:44 pm

Nope. Should use this:

<style type="text/css">

body {
background-image: url("http://www.feelprettyfotos.com/resources/images/background.jpg");
background-repeat: no-repeat;
background-attachment: fixed;
}

</style>

And set your background color using the color picker already in the gallery controls so as to prevent redundancy.

Reply

Nigel_L February 1, 2010 at 7:53 am

Hi Matt

I know this is a really minor issue, but noticed that the font used in the “comments” box on the contact page was different to all other fonts. I found a solution to this, by adding the following code to the gallery.css file:

.gather, #comments {
font-family: inherit; /* Added this line*/
font-size: inherit; /* Added this line*/
clear: both !important;
etc…
}

I am not sure if this is recommended, but it work fine for me :-)

Regards, Nigel

Reply

Nigel_L February 1, 2010 at 8:47 am

A simpler solution is to add the following to the “Add CSS rules in ” section in Output-Settings -> Advanced Options.

.gather, #comments {
font-family: inherit;
font-size: inherit;
}

Regards, Nigel

Reply

theturninggate February 1, 2010 at 11:22 am

Good ideas. I’ll add that to my codebase for later use. Thanks.

Reply

Gerald Figal February 6, 2010 at 10:55 am

Dumb question–how do I go about upgrading to 3.4?

Reply

theturninggate February 6, 2010 at 12:07 pm

When you purchased, you received a download URL for the engine. That same URL should be used to download updates.

Reply

Gerald Figal February 6, 2010 at 3:10 pm

Thanks, Matt! Got it!

Reply

Leave a Comment

Previous post:

Next post: