Adding Google Analytics

How to add Google Analytics to <Head> section of the HTML with eMuseum 6

Relevant versions: 6.0, 6.1, 6.2, 6.3, 6.4

Intro

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.

header 2

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

  1. Navigate to <eMuseum_home>\skins\[skinName]\com\gallerysystems\emuseum\core\components

  2. If this directory does not exist,

    1. create this directory

  3. Check whether Layout.tml exists under the component folder

    1. If not, copy Layout.tml from <Tomcat_home>\webapps\[root]\WEB-INF\classes\com\gallerysystems\emuseum\core\components

    2. paste Layout.tml to <eMuseum_home>\skins\[skinName]\com\gallerysystems\emuseum\core\components

    3. 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)

  4. Open Layout.tml file

  5. Find <t:statisticstrackingcode />

  6. Copy and paste it to other sections of the file as needed

  7. Save

  8. If your eMuseum is in Production mode, restart Apache Tomcat for the change to take effect

(2) When a custom skin is NOT applied

  1. We do not recommend modifying the source file under this directory <Tomcat_home>\webapps

  2. Instead, please create a new folder under <eMuseum_home>\skins. The folder name will become the skin name

  3. Download the attached .zip file below

custom_skin.zip

  1. unzip the content to <eMuseum_home>\skins folder,

  2. rename custom_skin to a preferred skin name

  3. skip to step 9

4. Under <eMuseum_home>\skins\[skinName], create folder META-INF and subfolders assets\css

  1. 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

  1. 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

  1. Under META-INF\assets\css, create a new file called custom.js

Copy and paste the empty function below to custom.js

define([
    "jquery"
], function($) {
});
  1. 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

  1. 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.

  1. paste Layout.tml to <eMuseum_home>\skins\[skinName]\com\gallerysystems\emuseum\core\components

  2. Open Layout.tml file

  3. Find <t:statisticstrackingcode />

  4. Copy and paste it to other sections of the file as needed

  5. Save

  6. If your eMuseum is in Production mode, restart Apache Tomcat for the change to take effect.

Last updated