You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/06/03 14:29:00 UTC

[jira] [Commented] (MSKINS-129) Update Google Analytics to new analytics.js

    [ https://issues.apache.org/jira/browse/MSKINS-129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16499440#comment-16499440 ] 

ASF GitHub Bot commented on MSKINS-129:
---------------------------------------

asfgit closed pull request #3: MSKINS-129 Update Google Analytics to new analytics.js
URL: https://github.com/apache/maven-fluido-skin/pull/3
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Update Google Analytics to new analytics.js
> -------------------------------------------
>
>                 Key: MSKINS-129
>                 URL: https://issues.apache.org/jira/browse/MSKINS-129
>             Project: Maven Skins
>          Issue Type: Improvement
>          Components: Fluido Skin
>    Affects Versions: fluido-1.5
>            Reporter: Hervé Boutemy
>            Assignee: Michael Osipov
>            Priority: Major
>             Fix For: fluido-1.8
>
>
> see https://developers.google.com/analytics/devguides/collection/gajs/



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)