You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2018/06/03 14:28:13 UTC
[maven-fluido-skin] branch master updated: [MSKINS-129] Update
Google Analytics to new analytics.js
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-fluido-skin.git
The following commit(s) were added to refs/heads/master by this push:
new 110decc [MSKINS-129] Update Google Analytics to new analytics.js
110decc is described below
commit 110decc881892107a2f941e6c303528153627af0
Author: Sylwester Lachiewicz <sl...@gmail.com>
AuthorDate: Sun Jun 3 15:48:51 2018 +0200
[MSKINS-129] Update Google Analytics to new analytics.js
Replace old (legacy) ga.js
This closes #3
---
src/it/mskins-143_default/verify.groovy | 7 ++++---
src/it/mskins-143_false/verify.groovy | 7 ++++---
src/it/mskins-143_true/verify.groovy | 7 ++++---
src/main/resources/META-INF/maven/site-macros.vm | 20 +++++++++-----------
src/site/site.xml | 2 +-
5 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/src/it/mskins-143_default/verify.groovy b/src/it/mskins-143_default/verify.groovy
index 1ef21b4..d561d4f 100644
--- a/src/it/mskins-143_default/verify.groovy
+++ b/src/it/mskins-143_default/verify.groovy
@@ -19,6 +19,7 @@
File index = new File( basedir, "target/site/index.html" )
assert index.exists()
-assert 1 == index.getText().count( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
-assert 1 == index.getText().count( '_gaq.push([\'_gat._anonymizeIp\']);' )
-assert 1 == index.getText().count( '_gaq.push([\'_gat._forceSSL\']);' )
\ No newline at end of file
+assert 0 == index.getText().count( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
+assert 1 == index.getText().count( 'ga(\'create\', \'FOO-BAR\', \'auto\');' )
+assert 1 == index.getText().count( 'ga(\'set\', \'anonymizeIp\', true);' )
+assert 1 == index.getText().count( 'ga(\'set\', \'forceSSL\', true);' )
\ No newline at end of file
diff --git a/src/it/mskins-143_false/verify.groovy b/src/it/mskins-143_false/verify.groovy
index 1249af4..7a4559d 100644
--- a/src/it/mskins-143_false/verify.groovy
+++ b/src/it/mskins-143_false/verify.groovy
@@ -19,6 +19,7 @@
File index = new File( basedir, "target/site/index.html" )
assert index.exists()
-assert 1 == index.getText().count( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
-assert 0 == index.getText().count( '_gaq.push([\'_gat._anonymizeIp\']);' )
-assert 0 == index.getText().count( '_gaq.push([\'_gat._forceSSL\']);' )
\ No newline at end of file
+assert 0 == index.getText().count( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
+assert 1 == index.getText().count( 'ga(\'create\', \'FOO-BAR\', \'auto\');' )
+assert 0 == index.getText().count( 'ga(\'set\', \'anonymizeIp\', true);' )
+assert 0 == index.getText().count( 'ga(\'set\', \'forceSSL\', true);' )
\ No newline at end of file
diff --git a/src/it/mskins-143_true/verify.groovy b/src/it/mskins-143_true/verify.groovy
index 1ef21b4..d561d4f 100644
--- a/src/it/mskins-143_true/verify.groovy
+++ b/src/it/mskins-143_true/verify.groovy
@@ -19,6 +19,7 @@
File index = new File( basedir, "target/site/index.html" )
assert index.exists()
-assert 1 == index.getText().count( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
-assert 1 == index.getText().count( '_gaq.push([\'_gat._anonymizeIp\']);' )
-assert 1 == index.getText().count( '_gaq.push([\'_gat._forceSSL\']);' )
\ No newline at end of file
+assert 0 == index.getText().count( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
+assert 1 == index.getText().count( 'ga(\'create\', \'FOO-BAR\', \'auto\');' )
+assert 1 == index.getText().count( 'ga(\'set\', \'anonymizeIp\', true);' )
+assert 1 == index.getText().count( 'ga(\'set\', \'forceSSL\', true);' )
\ No newline at end of file
diff --git a/src/main/resources/META-INF/maven/site-macros.vm b/src/main/resources/META-INF/maven/site-macros.vm
index d32243b..ca19b3a 100644
--- a/src/main/resources/META-INF/maven/site-macros.vm
+++ b/src/main/resources/META-INF/maven/site-macros.vm
@@ -605,21 +605,19 @@ $indent </ul>##
#macro ( googleAnalytics $accountId )
#**##if( $accountId && $accountId != "" )
<!-- Google Analytics -->
- <script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', '$accountId']);
- _gaq.push(['_trackPageview']);
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ ga('create', '$accountId', 'auto');
+ ga('send', 'pageview');
#**##if( $decoration.getCustomValue( 'fluidoSkin.googleAnalytics.anonymizeIp', 'true' ) == 'true' )
- _gaq.push(['_gat._anonymizeIp']);
+ ga('set', 'anonymizeIp', true);
#**##end
#**##if( $decoration.getCustomValue( 'fluidoSkin.googleAnalytics.forceSSL', 'true' ) == 'true' )
- _gaq.push(['_gat._forceSSL']);
+ ga('set', 'forceSSL', true);
#**##end
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
</script>
#**##end
#end
diff --git a/src/site/site.xml b/src/site/site.xml
index 13fa828..b801864 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -27,7 +27,7 @@ under the License.
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
- <version>1.6</version>
+ <version>${project.version}</version>
</skin>
<custom>
--
To stop receiving notification emails like this one, please contact
michaelo@apache.org.