tarteaucitron.services.js 9.4 KB

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