]> _ Git - fluidbook-html5.git/commitdiff
wip #5311 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 10 Jun 2022 09:08:19 +0000 (11:08 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 10 Jun 2022 09:08:19 +0000 (11:08 +0200)
js/libs/fluidbook/fluidbook.share.js
js/libs/fluidbook/fluidbook.stats.js

index 1c747f8a8616cbafa0e71db279706961603a54ea..95f523b6eb1be95cb0c241f03f7e0279fca35bc3 100644 (file)
@@ -183,8 +183,7 @@ FluidbookShare.prototype = {
     },
 
     getShareLinks: function (hideLabels, url, context) {
-        var shareLinks = {},
-            shareHTML = '';
+        var shareLinks = {}, shareHTML = '';
 
         if (url === undefined || url === null || url === 'undefined') {
             url = '';
@@ -247,8 +246,7 @@ FluidbookShare.prototype = {
         if (callback != undefined) {
             callback();
         }
-    },
-    intentShare: function (subject, body) {
+    }, intentShare: function (subject, body) {
         if (subject == undefined) {
             subject = this.fluidbook.settings.title;
         }
@@ -266,16 +264,14 @@ FluidbookShare.prototype = {
             extras[window.plugins.webintent.EXTRA_SUBJECT] = subject;
             extras[window.plugins.webintent.EXTRA_TEXT] = body;
             window.plugins.webintent.startActivity({
-                action: window.plugins.webintent.ACTION_SEND,
-                type: 'text/plain',
-                extras: extras
+                action: window.plugins.webintent.ACTION_SEND, type: 'text/plain', extras: extras
             }, function (args) {
             }, function (args) {
             });
         } else {
             window.location = 'mailto:?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body);
         }
-        this.fluidbook.stats.track(5);
+        this.fluidbook.stats.track(5, null, 'email');
     },
 
     getTweetContent: function (url, context) {
@@ -302,7 +298,7 @@ FluidbookShare.prototype = {
             mailtoParams.push('body=' + body);
         }
         window.location = 'mailto:?' + mailtoParams.join('&');
-        this.fluidbook.stats.track(5);
+        this.fluidbook.stats.track(5, null, 'email');
     },
 
     _getShortShare: function (url, context) {
@@ -325,23 +321,19 @@ FluidbookShare.prototype = {
         var data = this._getShortShare(url, context);
 
         this.fluidbook.wopen('https://twitter.com/intent/tweet?source=webclient' + data.url + '&text=' + encodeURIComponent(data.content), 'share_twitter', 'width=650,height=400');
-        this.fluidbook.stats.track(13);
-    },
-    sendWhatsapp: function (url, context) {
+        this.fluidbook.stats.track(13, null, 'twitter');
+    }, sendWhatsapp: function (url, context) {
         var data = this._getShortShare(url, context);
         this.fluidbook.wopen('https://api.whatsapp.com/send?text=' + encodeURIComponent(data.content), 'share_whatsapp', 'width=600,height=600');
-        this.fluidbook.stats.track(12);
-    },
-    sendFacebook: function (url, context) {
+        this.fluidbook.stats.track(12, null, 'whatsapp');
+    }, sendFacebook: function (url, context) {
         this.fluidbook.wopen('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(this.getShareURL(url)), 'share_facebook', 'width=650,height=400');
-        this.fluidbook.stats.track(12);
-    },
-    sendLinkedin: function (url, context) {
+        this.fluidbook.stats.track(12, null, 'facebook');
+    }, sendLinkedin: function (url, context) {
         this.fluidbook.wopen('https://www.linkedin.com/sharing/share-offsite/?url=' + encodeURIComponent(this.getShareURL(url)), 'share_linkedin', 'width=650,height=400');
-        this.fluidbook.stats.track(12);
-    },
-    sendPinterest: function (url, context) {
+        this.fluidbook.stats.track(12, null, 'linkedin');
+    }, sendPinterest: function (url, context) {
         this.fluidbook.wopen('http://pinterest.com/pin/create/button/?url=' + encodeURIComponent(this.getShareURL(url)) + '&media=' + encodeURIComponent('https://workshop.fluidbook.com/services/facebook_thumbnail?id=' + this.fluidbook.settings.id + '&j=' + Date.now()) + '"', 'width=650,height=400');
-        this.fluidbook.stats.track(12);
+        this.fluidbook.stats.track(12, null, 'pinterest');
     }
 };
index 78be6f25165ff4110686d7085954186ba8b6c091..9b545e7cfebbe7129c29ecf8bd118f5f516378f7 100644 (file)
@@ -216,7 +216,7 @@ FluidbookStats.prototype = {
             case 5: // Share\r
             case 12: // Facebook\r
             case 13: // Twitter\r
-                window._paq.push(['trackEvent', 'share', 'send', type]);\r
+                window._paq.push(['trackEvent', 'share', 'send', extra]);\r
                 break;\r
             case 7: // PDF\r
             case 8: // Partial PDF\r