coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: totalcollection on September 24, 2008, 07:15:26 AM

Title: How Do We Integrate Google Analytic
Post by: totalcollection on September 24, 2008, 07:15:26 AM
I wonder where can we put google analytic code in CopperMind to collect visitors data. Where can we insert it to go with any theme?

Thanks in advance.
Title: Re: How Do We Integrate Google Analytic
Post by: Sami on September 24, 2008, 07:26:26 AM
you can add it to each theme
{gallery-root}/themes/{your-theme}/template.html
Or you can add it to {gallery-root}/anycontent.php and then enable it at config=>Album list view=>The content of the main page (//http://)
Title: Re: How Do We Integrate Google Analytic
Post by: Joachim Müller on September 24, 2008, 07:53:00 AM
Instead of adding it to anycontent.php (which will only be taken into account for index files) I suggest to add the google analytics code to the custom footer. This way, it will be used no matter what theme you use. That's what I did for our demo: I used the config field "Path to custom footer include" and entered there the value ../custom_footer.php, as our demo gallery resides at http://coppermine-gallery.net/Obsolete, while the custom footer file resides at http://coppermine-gallery.net/demo/custom_footer.php
The custom footer file contains the tracker code.

Bottom line: for "regular" galleries, where you only have one theme and don't allow users to switch to another theme, just add the code of the tracker to themes/yourtheme/template.html. For galleries where users are allowed to choose from different themes, use the custom footer option.

However, this is not related at all to bridging, but to theming, so I'm moving your thread accordingly.
Title: Re: How Do We Integrate Google Analytic
Post by: totalcollection on October 19, 2008, 02:25:05 PM
QuoteI used the config field "Path to custom footer include" and entered there the value ../custom_footer.php, as our demo gallery resides at http://coppermine-gallery.net/Obsolete, while the custom footer file resides at http://coppermine-gallery.net/demo/custom_footer.php
The custom footer file contains the tracker code.

You meant custom_footer.php is not included by default, but we must create it then put in the http://coppermine-gallery.net/demo/

with the code in it?
Title: Re: How Do We Integrate Google Analytic
Post by: totalcollection on October 19, 2008, 02:35:13 PM
I got to config as instructed, but can't find where to call the custom footer file in?
I have attached my screenshot:
Title: Re: How Do We Integrate Google Analytic
Post by: Joachim Müller on October 19, 2008, 02:42:31 PM
http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#admin_theme_include_path_start
Title: Re: How Do We Integrate Google Analytic
Post by: totalcollection on October 20, 2008, 09:14:21 PM
Thanks for pointing, but still not clear where to call that custom file.

QuotePath to custom header include

Optional relative path to a custom header file. Using this option, you can include non-coppermine code bits to be included into your theme, e.g. an overall navigation that gets included on your whole website. You can only add a relative path (seen from the root path of your coppermine install) - not an absolute one, nor a http include from another website. This option is only meant for experienced users who have some PHP know-how.

Warning: you mustn't include full html pages that contain an html header or footer (tags like <head> or <body>), nor can the included file do file header manipulation, e.g. reading another (non-coppermine) cookie.

[cpg1.4.0 or better required]
Path to custom footer include

Optional relative path to a custom footer file. The same remarks apply as for the custom header include path.

Sorry for any disturbing this may cause.
Title: Re: How Do We Integrate Google Analytic
Post by: Gizmo on October 21, 2008, 02:55:09 PM
It's right there in the image you posted. It's the last line in Config->Themes Settings. Create an file called footer.html and place your code in there without all the html tags.

[EDIT] I did a search form google analytics and got lots of hits. Here's one (http://forum.coppermine-gallery.net/index.php/topic,39898.0.html) for you to start at.
Title: Re: How Do We Integrate Google Analytic
Post by: totalcollection on October 22, 2008, 05:28:06 PM
Do I have to enter absolute path: http://coppermine-gallery.net/demo/custom_footer.php
Thanks in advance
Title: Re: How Do We Integrate Google Analytic
Post by: totalcollection on October 22, 2008, 05:45:07 PM
Edit: I uploaded my custom_footer.php with google analytic code to the root, then enter custom_footer.php
Working fine.
Thx for all the supports.  :D
Title: Re: How Do We Integrate Google Analytic
Post by: Joachim Müller on October 22, 2008, 07:28:58 PM
Thanks for resolving your thread. For others who come across this thread: it's much easier to add the code to themes/yourtheme/template.html, as suggested earlier. What the thread starter did will work, but is needlessly complicated.