From d27538a4fd71d8805b278de1d6ae6beab9d1037e Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 10 Jun 2022 11:08:19 +0200 Subject: [PATCH] wip #5311 @0.25 --- js/libs/fluidbook/fluidbook.share.js | 36 +++++++++++----------------- js/libs/fluidbook/fluidbook.stats.js | 2 +- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.share.js b/js/libs/fluidbook/fluidbook.share.js index 1c747f8a..95f523b6 100644 --- a/js/libs/fluidbook/fluidbook.share.js +++ b/js/libs/fluidbook/fluidbook.share.js @@ -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'); } }; diff --git a/js/libs/fluidbook/fluidbook.stats.js b/js/libs/fluidbook/fluidbook.stats.js index 78be6f25..9b545e7c 100644 --- a/js/libs/fluidbook/fluidbook.stats.js +++ b/js/libs/fluidbook/fluidbook.stats.js @@ -216,7 +216,7 @@ FluidbookStats.prototype = { case 5: // Share case 12: // Facebook case 13: // Twitter - window._paq.push(['trackEvent', 'share', 'send', type]); + window._paq.push(['trackEvent', 'share', 'send', extra]); break; case 7: // PDF case 8: // Partial PDF -- 2.39.5