Topic: GOOGLE Analytics script

I have successfully created a gallery and posted it online using Juicebox Pro.  I would now like to track visitors to the site using GOOGLE Analytics.

I know that you have to paste Google's script on your website to do this.  My questions in which document(s) in the Juicebox Gallery folder do you modify and place the Google script? Thanks.

Re: GOOGLE Analytics script

If you are using the latest asynchronous syntax, then the code should be placed immediately before the closing </head> tag of the gallery's 'index.html' page (or the page into which you are embedding your gallery).
If you are using the older style synchronous code, then the code should be placed immediately before the closing </body> tag of the same HTML document.

Re: GOOGLE Analytics script

Steve - thank you for your quick response and info regarding my question about the Google Analytics script.

Before I posted the msg here on the Juicebox Support Forum, I did try to insert the Google script into the index.html document.  However, when I opened the index.html document with a text editing program, the document was blank with no text or html coding visible and the title bar of the document indicated that the document was locked.  ???

Re: GOOGLE Analytics script

OK Steven.

But you can also add it inside the index.html template file, no ?

Re: GOOGLE Analytics script

If the document was locked, it was perhaps open in (and, therefore, locked by) another program (such as a browser) at the time you tried to edit it.
Try closing all open programs first before launching your text editor and opening the 'index.html' file in it.

Re: GOOGLE Analytics script

@Eric

Yes, indeed. You can add the Google Analytics code directly to the C:\Program Files (x86)\JuiceboxBuilder-Pro\template\index.html file and the code will be included in every subsequent gallery created by JuiceboxBuilder-Pro.
Please note that if you embed the gallery in a different web page, then the Google Analytics code will still need to be added to that page.

Re: GOOGLE Analytics script

If the code is added to the template, is it lost after an upgrade to JuiceBox Pro?

Re: GOOGLE Analytics script

@gfs

The C:\Program Files (x86)\JuiceboxBuilder-Pro\template\index.html file will be overwritten when installing a new version of JuiceboxBuilder-Pro.

There may be changes to the 'index.html' template file between versions so I would recommend adding your Google Analytics code to each new version (it should take just a couple of minutes to copy and paste the code) rather than to save the old 'index.html' file.

Re: GOOGLE Analytics script

Has this changed in 1.4 Steven?

I'm saving my StatCounter code into the (/Applications/JuiceboxBuilder-Pro.app/Contents/Resources/template/index.html) but it's not showing up in the JBx Publish window, in the Get Embed Code section.  It used to.

Re: GOOGLE Analytics script

As far as I am aware, the code used to populate the Embed Code window on the Publish tab of JuiceboxBuilder-Pro is not generated from any code within the 'template/index.html' file. This seems to have always been the case (at least since v1.3.3 on Windows).
However, any modifications you make to the 'template/index.html' file will be included in the gallery's output 'index.html' file.

11

Re: GOOGLE Analytics script

I don't understand what you said at all Steven!

Maybe I'm getting confused about which file to alter.  Which one is it on a Mac?

Re: GOOGLE Analytics script

The code presented in the Embed Code window is generated internally by JuiceboxBuilder-Pro and has nothing to do with the 'template/index.html' file. The 'template/index.html' file is used only to generate the output 'index.html' file (in the gallery folder). There is nothing you can do to change the code which appears in the Embed Code window.

You can modify the 'template/index.html' file, though, and any changes you make to this file will be reflected in the gallery's own 'index.html' file once you save the gallery.

On Mac, it looks like the 'template/index.html' can be found here: /Applications/JuiceboxBuilder-Pro.app/Contents/Resources/template/index.html (although I do not have a Mac to check this path)
On PC, it can be found here: C:\Program Files (x86)\JuiceboxBuilder-Pro\template\index.html

I hope this helps to clarify things.

Re: GOOGLE Analytics script

Just to add a remark to that post. When you are, like me, generating galleries from lightroom the file to modify to include the Google script is the index.html that is in the "juicebox.lrwebengine" directory