Adding Google Analytics
How to add Google Analytics to <Head> section of the HTML with eMuseum 6
Last updated
How to add Google Analytics to <Head> section of the HTML with eMuseum 6
Last updated
Relevant versions: 6.0, 6.1, 6.2, 6.3, 6.4
Please note the following:
We have planned to include Google Analytics in different sections of the HTML in eMuseum version 6.5
If your eMuseum site is hosted by Gallery Systems, please reach out to Gallery Systems support and request the change instead
In eMuseum6.4.* and prior versions, there is not a configuration setting to add Google Analytics to <Head> section of the HTML, this article is going to step you through how to achieve it by modifying the Layout.tml skin file.
The file location of Layout.tml may differ for each client, especially when custom eMuseum skin is applied.
First of all, go to eMuseum Configuration page > Display Settings > Skins, or this url path http(s)://eMuseumUrl/configuration/skins, and check which skin is selected currently.
Internal implies that your eMuseum application is reading the skin files directly from <Tomcat_home>\webapps directory and that you are NOT using a custom skin.
If Internal is selected, proceed further down this guide to (2) When a custom skin is NOT applied.
If your skin is NOT "Internal", mark the skin name and locate the skin folder under <eMuseum_home>\skins folder. Proceed to (1) When a custom skin is applied.
(1) When a custom skin is applied
Navigate to <eMuseum_home>\skins\[skinName]\com\gallerysystems\emuseum\core\components
If this directory does not exist,
create this directory
Check whether Layout.tml exists under the component folder
If not, copy Layout.tml from <Tomcat_home>\webapps\[root]\WEB-INF\classes\com\gallerysystems\emuseum\core\components
paste Layout.tml to <eMuseum_home>\skins\[skinName]\com\gallerysystems\emuseum\core\components
note that if eMuseum is not the root directory, you need to replace the root folder (<Tomcat_home>\webapps\[root]) with the actual eMuseum folder name (e.g.,<Tomcat_home>\webapps\emuseum)
Open Layout.tml file
Find <t:statisticstrackingcode />
Copy and paste it to other sections of the file as needed
Save
If your eMuseum is in Production mode, restart Apache Tomcat for the change to take effect
(2) When a custom skin is NOT applied
We do not recommend modifying the source file under this directory <Tomcat_home>\webapps
Instead, please create a new folder under <eMuseum_home>\skins. The folder name will become the skin name
Download the attached .zip file below
unzip the content to <eMuseum_home>\skins folder,
rename custom_skin to a preferred skin name
skip to step 9
4. Under <eMuseum_home>\skins\[skinName], create folder META-INF and subfolders assets\css
The result should look like this <eMuseum_home>\skins\[skinName]\META-INF\assets\css
5. Under META-INF\assets\css, create a new file called custom.scssLeave the .scss file empty, eMuseum just needs it to exist
Under <eMuseum_home>\skins\[skinName]\META-INF \assets (folders you just created), create another subfolders js
The result should look like this <eMuseum_home>\skins\[skinName]\META-INF\assets\js
Under META-INF\assets\css, create a new file called custom.js
Copy and paste the empty function below to custom.js
Navigate to <eMuseum_home>\skins\[skinName], create this folder path com\gallerysystems\emuseum\core\components
The result should look like this <eMuseum_home>\skins\[skinName]\com\gallerysystems\emuseum\core\components
copy Layout.tml from <Tomcat_home>\webapps\[root]\WEB-INF\classes\com\gallerysystems\emuseum\core\components
note that if eMuseum is not the root directory, you must replace the root folder above with the actual eMuseum folder.
paste Layout.tml to <eMuseum_home>\skins\[skinName]\com\gallerysystems\emuseum\core\components
Open Layout.tml file
Find <t:statisticstrackingcode />
Copy and paste it to other sections of the file as needed
Save
If your eMuseum is in Production mode, restart Apache Tomcat for the change to take effect.