Use of Google Analytics

Anonymize and warn

”Web analytics is the measurement, collection, analysis and reporting of web data for purposes of understanding and optimizing web usage. However, Web analytics is not just a process for measuring web traffic but can be used as a tool for business and market research, and to assess and improve the effectiveness of a website. Web analytics provides information about the number of visitors to a website and the number of page views. It helps gauge traffic and popularity trends which is useful for market research.” © Copyright Wikipedia – CC BY-SA 3.0

Traffic analysis at EPFL can be done free of charge using the Google Analytics tool. Currently, Google Analytics Anonymized is the only tracking tool approved at EPFL . It is deployed on most standard VPSI services. To use other tracking tools, please contact the VPSI.

By using Google Analytics, you agree to the Google Analytics Terms and Conditions, so you allow Google and its partners to use, host, store, reproduce and modify the data it analyzes.

The Law on Protection of Personal Data (LPRD Art.13) forces the webmaster in charge to inform the visitor of any collection of his or her personal data. Thus, it is necessary to anonymize the script provided by Google and to warn Internet users using the below procedure (in french). If you use some VPSI  services (WordPress ‘managed’, Actu, Memento, People), these elements are designed by default.

A general Analytics account is implemented to track all pages under

You can add your own account on WordPress instances distributed by the VPSI (‘managed’ sites). To do this, you must create your account on Analytics, then implement the code received (“tracking ID”) in the “EPFL Settings” menu of your WordPress site.

We are unable to trace the owners of the accounts thus implemented.

The Law on Protection of Personal Data (LPRD Art.13), obliges the controller to inform the personal data subject for the collection of data concerning. Thus, on the one hand, the script provided by Google must be anonymized and, on the other hand, warn the internet users with the procedure below. IT managers who create and manage sites independently, without using VPSI services, are obligated to take such action.

  1. Log on to
  2. Follow Google Analytics instructions
  3. Retrieve the identifier (ID) linked to this account (for example UA-12345678-9) to implement it on your site.

A Google Account is linked to the person who created it and manages its administrators. EPFL (or IT support) is unable to know who owns an account, or to know its administrators.

If you manage your own system, you must anonymize the IPs in Google Analytics. Please do the following 2 operations :

  1. Add the anonymization command :

    ga (‘set’, ‘anonymizeIp’, true);

    This command is placed after the “create” command and before the “send” command

  2. Replace the domain name ‘’ with ‘auto’ so that Google Analytics correctly manages the subdomains :

    ga (‘create’, ‘UA-XXXXXXX-Y’, ‘auto’);

  3. At the end, you should get a script similar to the example below:

    ga (‘create’, ‘UA-XXXXXXX-Y’, ‘auto’)
    ga (‘set’, ‘anonymizeIp’, true);
    ga (‘send’, ‘pageview’);

Warning : for those who still use the (very) old Google script ga.js, instead of analytics.js. We strongly recommend that you update to analytics.js (see documentation below), otherwise you must add the command:

_gaq.push ([‘_gat._anonymizeIp’]);
before order :
_gaq.push ([‘_ trackPageview’]);
assuming that the variable _gaq is the variable containing the parameters for ga.js.

For more info, see official Google documentation.

The link to the legal notices is mandatory on all websites (visible outside) of the domain.

This link is automatically added to the sites generated by certain VPSI tools.

For all other sites, the code to add in the footer is :

  • in french :
    <a title="Mentions légales" href="">Mentions légales</a>
  • in English
    <a title="Legal notice" href=">Legal notice</a>

For the layout, see the example on the home page

Since August 29, 2017, the warning message is installed in the following libraries :


This file is automatically added to sites and applications managed by the VPSI.

If your site includes the .css file as well as one of the javascript files mentioned above, it should also appear automatically.

If your site does not include them, you must add the following two libraries which only contain the functionality of the warning message :


The solution uses a cookie on the domain so as not to repeat the display of the message. This cookie has a lifespan of 365 days.

How to ensure that your site is well referenced?

In general, follow Google’s recommendations on their best practices page.

As part of the internal search engine at EPFL, a simple exercise is to do a test with the desired search (word). If your site is poorly classified, contact the webmaster of the page that appears in first position and ask him to add a link to your website on his page.

How to use the ‘analytics’ tool ?

Follow the tool’s help on the Google support site.