If i include Google Analytics JS code inside a php page GPL licensed (WordPress template), is it ok with GPL license?

I'm asking beacause I think Google Analytics is not open source code.

up vote 3 down vote accepted

The Google Analytics (GA) Terms of Service clearly state that GA is not under a GPL-compatible license:

Subject to the terms and conditions of this Agreement,
  (a) Google grants You a limited, revocable, non-exclusive, non-sublicensable license to install, copy and use the GATC solely as necessary for You to use the Service on Your Properties or Third Party's Properties; and
  (b) […]

You will not (and You will not allow any third party to)
  (i) copy, modify, adapt, translate or otherwise create derivative works of the Software or the Documentation;
  (ii) reverse engineer, decompile, disassemble or otherwise attempt to discover the source code of the Software, except as expressly permitted by the law in effect in the jurisdiction in which You are located;
  (iii) rent, lease, sell, assign or otherwise transfer rights in or to the Software, the Documentation or the Service; […]

(line breaks, emphasis, and ellipsis mine)

It is therefore not possible to create a work that is derived from both GPL-licensed software and GA.

Then the question is whether merely linking to GA with a <script src="..."> even creates a derived work. In particular, what aspects of a web page constitute a copyrightable work, and when is a web page distributed/conveyed?

The Wordpress PHP code outputs some HTML. This HTML is transmitted to the client where it is parsed into a DOM. This DOM can also include the GA tracking code.

It is possible to argue that the PHP templates copy large parts of themselves into the HTML output, therefore the HTML is a derived work of the Wordpress PHP code and inherits the GPL. Fortunately, that does not seem to be the case.

(If the HTML were subject to the GPL, note that the GPL would here behave more like the AGPL, and you would have to offer the source code of Wordpress and any plugins to your visitors. It would also mean that any content in that HTML (such as blog posts) would have to be published under a GPL-compatible license. Wordpress licensing has never been understood like this.)

I think we can therefore conclude:

  • Only the PHP code on the server is subject to the GPL. Its output is not.
  • The HTML and DOM may include GPL fragments such as individual scripts or images, but is not in its entirety subject to the GPL.
  • The HTML and DOM may include works that are not GPL-compatible, such as images, literary works, and also a GA tracking code.
  • The important part is that the GPL'ed PHP code is not derived from the GA-TC. You cannot bundle the GA code with a Wordpress template/plugin. However, it may be fine to link to GA. It is definitively fine to make local modifications to the templates/plugins that link to GA, if you do not distribute these modifications.
  • WOW amon! this answer it's Great!!! Many thanks. Just not sure to understand (my English it's not really good) how link GA-TC, when i go to my Google Analytics profile, i find the whole code to include. Is it possible just link the GA-TC? – Orso Nero Aug 5 at 11:28
  • 1
    @OrsoNeroツ The code snippet you copy into your page loads the actual tracking script, and sets up a way to record events before that script is loaded. I am not sure whether you can copy this snippet into templates that you license to others under the GPL. But you can certainly modify templates that you do not distribute to include the GA snippet. – amon Aug 5 at 14:19
  • Thanks amon, so if i run my template just on my web server should be ok? The Js running in user browser dosen't affect the server side code? – Orso Nero Aug 5 at 15:35
  • 1
    @OrsoNeroツ Your understanding seems to be correct. The server-side code license and client-side code license can usually be discussed separately (not always). – amon Aug 5 at 19:39
  • Thanks amon! know it's clear, and sorry for ask two time the same concept. – Orso Nero Aug 5 at 19:47

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.