tarteaucitron.services.js 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. /*global tarteaucitron, ga, Shareaholic, stLight*/
  2. // piwik
  3. tarteaucitron.services.piwik = {
  4. "key": "piwik",
  5. "type": "analytics",
  6. "name": "Piwik",
  7. "uri": "http://piwik.org/privacy/",
  8. "needConsent": false,
  9. "js": function () {
  10. "use strict";
  11. if (tarteaucitron.user.piwikServer === undefined ||
  12. tarteaucitron.user.piwikSiteId === undefined) { return; }
  13. var _paq = _paq || [];
  14. _paq.push([function () {
  15. var self = this;
  16. function getOriginalVisitorCookieTimeout() {
  17. var now = new Date(),
  18. nowTs = Math.round(now.getTime() / 1000),
  19. visitorInfo = self.getVisitorInfo(),
  20. createTs = parseInt(visitorInfo[2]),
  21. cookieTimeout = 33696000,
  22. originalTimeout = createTs + cookieTimeout - nowTs;
  23. return originalTimeout;
  24. }
  25. this.setVisitorCookieTimeout(getOriginalVisitorCookieTimeout());
  26. }]);
  27. _paq.push(['trackPageView']);
  28. _paq.push(['enableLinkTracking']);
  29. _paq.push(['setTrackerUrl', tarteaucitron.user.piwikServer + 'piwik.php']);
  30. _paq.push(['setSiteId', tarteaucitron.user.piwikSiteId]);
  31. if (typeof tarteaucitron.user.analyticsMore() === 'function') {
  32. tarteaucitron.user.piwikMore();
  33. }
  34. tarteaucitron.addScript('//' + tarteaucitron.user.piwikServer + '/piwik.js');
  35. }
  36. };
  37. // disqus
  38. tarteaucitron.services.disqus = {
  39. "key": "disqus",
  40. "type": "social",
  41. "name": "Disqus",
  42. "uri": "https://help.disqus.com/customer/portal/articles/466259-privacy-policy",
  43. "needConsent": true,
  44. "js": function () {
  45. "use strict";
  46. if (tarteaucitron.user.disqusShortname === undefined) {
  47. return;
  48. }
  49. tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/embed.js');
  50. tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/count.js');
  51. },
  52. "fallback": function () {
  53. "use strict";
  54. var id = 'disqus';
  55. document.getElementById('disqus_thread').innerHTML = tarteaucitron.engage(id);
  56. }
  57. };
  58. // shareathis
  59. tarteaucitron.services.sharethis = {
  60. "key": "sharethis",
  61. "type": "social",
  62. "name": "ShareThis",
  63. "uri": "http://www.sharethis.com/legal/privacy/",
  64. "needConsent": true,
  65. "js": function () {
  66. "use strict";
  67. if (tarteaucitron.user.sharethisPublisher === undefined) {
  68. return;
  69. }
  70. var switchTo5x = true,
  71. uri = ('https:' === document.location.protocol ? 'https://ws' : 'http://w') + '.sharethis.com/button/buttons.js';
  72. tarteaucitron.fallback(['tacSharethis'], '');
  73. tarteaucitron.addScript(uri, '', function () {
  74. stLight.options({publisher: tarteaucitron.user.sharethisPublisher, doNotHash: false, doNotCopy: false, hashAddressBar: false});
  75. });
  76. },
  77. "fallback": function () {
  78. "use strict";
  79. var cookies = ['__unam'],
  80. id = 'sharethis';
  81. tarteaucitron.cookie.purge(cookies);
  82. tarteaucitron.fallback(['tacSharethis'], tarteaucitron.engage(id));
  83. }
  84. };
  85. // shareaholic
  86. tarteaucitron.services.shareaholic = {
  87. "key": "shareaholic",
  88. "type": "social",
  89. "name": "Shareaholic",
  90. "uri": "https://shareaholic.com/privacy/choices",
  91. "needConsent": true,
  92. "js": function () {
  93. "use strict";
  94. if (tarteaucitron.user.shareaholicSiteId === undefined) {
  95. return;
  96. }
  97. tarteaucitron.fallback(['shareaholic-canvas'], '');
  98. tarteaucitron.addScript('//dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic.js', '', function () {
  99. try {
  100. Shareaholic.init(tarteaucitron.user.shareaholicSiteId);
  101. } catch (e) {}
  102. });
  103. },
  104. "fallback": function () {
  105. "use strict";
  106. var cookies = ['__utma', '__utmb', '__utmc', '__utmz'],
  107. id = 'shareaholic';
  108. tarteaucitron.cookie.purge(cookies);
  109. tarteaucitron.fallback(['shareaholic-canvas'], tarteaucitron.engage(id));
  110. }
  111. };
  112. // addthis
  113. tarteaucitron.services.addthis = {
  114. "key": "addthis",
  115. "type": "social",
  116. "name": "AddThis",
  117. "uri": "http://www.addthis.com/privacy/privacy-policy#publisher-visitors",
  118. "needConsent": true,
  119. "js": function () {
  120. "use strict";
  121. if (tarteaucitron.user.addthisPubId === undefined) {
  122. return;
  123. }
  124. tarteaucitron.fallback(['addthis_sharing_toolbox'], '');
  125. tarteaucitron.addScript('//s7.addthis.com/js/300/addthis_widget.js#pubid=' + tarteaucitron.user.addthisPubId);
  126. },
  127. "fallback": function () {
  128. "use strict";
  129. var cookies = ['__atuvc'],
  130. id = 'addthis';
  131. tarteaucitron.cookie.purge(cookies);
  132. tarteaucitron.fallback(['addthis_sharing_toolbox'], tarteaucitron.engage(id));
  133. }
  134. };
  135. // ferank
  136. tarteaucitron.services.ferank = {
  137. "key": "ferank",
  138. "type": "analytics",
  139. "name": "FERank",
  140. "uri": "https://www.ferank.fr/respect-vie-privee/#mesureaudience",
  141. "needConsent": false,
  142. "js": function () {
  143. "use strict";
  144. tarteaucitron.addScript('//static.ferank.fr/pixel.js', '', function () {
  145. if (typeof tarteaucitron.user.ferankMore === 'function') {
  146. tarteaucitron.user.ferankMore();
  147. }
  148. });
  149. }
  150. };
  151. // facebook
  152. tarteaucitron.services.facebook = {
  153. "key": "facebook",
  154. "type": "social",
  155. "name": "Facebook",
  156. "uri": "https://www.facebook.com/help/cookies/",
  157. "needConsent": true,
  158. "js": function () {
  159. "use strict";
  160. tarteaucitron.fallback(['fb-like'], '');
  161. tarteaucitron.addScript('//connect.facebook.net/fr_FR/sdk.js#xfbml=1&version=v2.0', 'facebook-jssdk');
  162. },
  163. "fallback": function () {
  164. "use strict";
  165. tarteaucitron.fallback(['fb-post', 'fb-follow', 'fb-comments', 'fb-activity', 'fb-like-box', 'fb-send', 'fb-share-button', 'fb-like'], '<a href="https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(document.location) + '" target="_blank" class="tac_share tac_share_facebook">Facebook</a>');
  166. }
  167. };
  168. // google adsense
  169. tarteaucitron.services.adsense = {
  170. "key": "adsense",
  171. "type": "ads",
  172. "name": "Adsense (Google)",
  173. "uri": "http://www.google.com/ads/preferences/",
  174. "needConsent": true,
  175. "js": function () {
  176. "use strict";
  177. tarteaucitron.addScript('//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js');
  178. },
  179. "fallback": function () {
  180. "use strict";
  181. var id = 'adsense';
  182. tarteaucitron.fallback(['adsbygoogle'], tarteaucitron.engage(id));
  183. }
  184. };
  185. // google analytics
  186. tarteaucitron.services.analytics = {
  187. "key": "analytics",
  188. "type": "analytics",
  189. "name": "Analytics (Google)",
  190. "uri": "https://support.google.com/analytics/answer/6004245",
  191. "needConsent": true,
  192. "js": function () {
  193. "use strict";
  194. window.GoogleAnalyticsObject = 'ga';
  195. window.ga = window.ga || function () {
  196. window.ga.q = window.ga.q || [];
  197. window.ga.q.push(arguments);
  198. };
  199. window.ga.l = new Date();
  200. tarteaucitron.addScript('//www.google-analytics.com/analytics.js', '', function () {
  201. ga('create', tarteaucitron.user.analyticsUa, {'cookieExpires': 34128000});
  202. ga('send', 'pageview');
  203. if (typeof tarteaucitron.user.analyticsMore === 'function') {
  204. tarteaucitron.user.analyticsMore();
  205. }
  206. });
  207. },
  208. "fallback": function () {
  209. "use strict";
  210. var cookies = ['_ga', '_gat', '__utma', '__utmb', '__utmc', '__utmz'];
  211. tarteaucitron.cookie.purge(cookies);
  212. }
  213. };
  214. // google+
  215. tarteaucitron.services.gplus = {
  216. "key": "gplus",
  217. "type": "social",
  218. "name": "Google+",
  219. "uri": "http://www.google.fr/intl/policies/privacy/",
  220. "needConsent": true,
  221. "js": function () {
  222. "use strict";
  223. tarteaucitron.addScript('https://apis.google.com/js/platform.js');
  224. },
  225. "fallback": function () {
  226. "use strict";
  227. tarteaucitron.fallback(['g-page', 'g-plus', 'g-plusone'], '<a href="https://plus.google.com/share?url=' + encodeURIComponent(document.location) + '" target="_blank" class="tac_share tac_share_googlep">Google+</a>');
  228. }
  229. };
  230. // linkedin
  231. tarteaucitron.services.linkedin = {
  232. "key": "linkedin",
  233. "type": "social",
  234. "name": "Linkedin",
  235. "uri": "https://www.linkedin.com/legal/cookie_policy",
  236. "needConsent": true,
  237. "js": function () {
  238. "use strict";
  239. tarteaucitron.fallback(['tacLinkedin'], '');
  240. tarteaucitron.addScript('//platform.linkedin.com/in.js');
  241. },
  242. "fallback": function () {
  243. "use strict";
  244. tarteaucitron.fallback(['tacLinkedin'], '<a href="http://www.linkedin.com/shareArticle?mini=true&url=' + encodeURIComponent(document.location) + '" target="_blank" class="tac_share tac_share_linkedin">Linkedin</a>');
  245. }
  246. };
  247. // pinterest
  248. tarteaucitron.services.pinterest = {
  249. "key": "pinterest",
  250. "type": "social",
  251. "name": "Pinterest",
  252. "uri": "https://about.pinterest.com/privacy-policy",
  253. "needConsent": true,
  254. "js": function () {
  255. "use strict";
  256. tarteaucitron.addScript('//assets.pinterest.com/js/pinit.js');
  257. }
  258. };
  259. // twitter
  260. tarteaucitron.services.twitter = {
  261. "key": "twitter",
  262. "type": "social",
  263. "name": "Twitter",
  264. "uri": "https://support.twitter.com/articles/20170514",
  265. "needConsent": true,
  266. "js": function () {
  267. "use strict";
  268. tarteaucitron.fallback(['tacTwitter'], '');
  269. tarteaucitron.addScript('//platform.twitter.com/widgets.js', 'twitter-wjs');
  270. },
  271. "fallback": function () {
  272. "use strict";
  273. tarteaucitron.fallback(['tacTwitter'], '<a href="https://twitter.com/intent/tweet?text=' + encodeURIComponent(document.title) + '%20' + encodeURIComponent(document.location) + '" target="_blank" class="tac_share tac_share_twitter">Twitter</a>');
  274. }
  275. };