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