From 76f9824207a4b9e5cca11860f8d4b1e4760f79d5 Mon Sep 17 00:00:00 2001 From: Amauri CHAMPEAUX Date: Wed, 10 Jun 2015 12:05:56 +0200 Subject: [PATCH] Add Google Adsense Premium --- README.md | 5 ++++ tarteaucitron.js | 2 +- tarteaucitron.services.js | 48 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5e5bcc9..52c5aee 100644 --- a/README.md +++ b/README.md @@ -28,18 +28,22 @@ Bonus: * Google Adwords (conversion) * Google Adwords (remarketing) * Pubdirecte + * Twenga * vShop * APIs * Google jsapi * Google Maps * Google Tag Manager + * Timeline JS * Typekit (adobe) * Audience measurement * Alexa * Clicky + * Crazyegg * FERank + * Get+ * Google Analytics (ga.js) * Google Analytics (universal) * StatCounter @@ -54,6 +58,7 @@ Bonus: * AddThis * AddToAny (feed) * AddToAny (share) + * eKomi * Facebook * Facebook (like box) * Google+ diff --git a/tarteaucitron.js b/tarteaucitron.js index 52ffad2..c46dfcd 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -10,7 +10,7 @@ var scripts = document.getElementsByTagName('script'), tarteaucitronNoAdBlocker = false; var tarteaucitron = { - "version": 300, + "version": 301, "cdn": cdn, "user": {}, "lang": {}, diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index d84b0f8..928bc83 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -1,4 +1,4 @@ -/*global tarteaucitron, ga, Shareaholic, stLight, clicky, top, google, Typekit, FB, ferankReady, IN, stButtons, twttr*/ +/*global tarteaucitron, ga, Shareaholic, stLight, clicky, top, google, Typekit, FB, ferankReady, IN, stButtons, twttr, GS_googleAddAdSenseService, GS_googleEnableAllServices, GA_googleAddSlot, GA_googleFetchAds*/ /*jslint regexp: true, nomen: true*/ // addthis @@ -565,6 +565,52 @@ tarteaucitron.services.adsense = { } }; +// google adsense premium +tarteaucitron.services.adsensepremium = { + "key": "adsensepremium", + "type": "ads", + "name": "Google Adsense (premium)", + "uri": "http://www.google.com/ads/preferences/", + "needConsent": true, + "cookies": [], + "js": function () { + "use strict"; + if (tarteaucitron.user.adsensepremium === undefined) { + return; + } + + var div = document.createElement('div'), + increment = 0, + timer; + + div.setAttribute("id", "tarteaucitronAdsensePremium"); + document.getElementsByTagName('body')[0].appendChild(div); + + tarteaucitron.makeAsync.init('//partner.googleadservices.com/gampad/google_service.js', 'tarteaucitronAdsensePremium'); + timer = setInterval(function () { + increment += 1; + if (typeof GS_googleAddAdSenseService !== "undefined" && + typeof GS_googleEnableAllServices !== "undefined" && + typeof GA_googleAddSlot !== "undefined" && + typeof GA_googleFetchAds !== "undefined") { + + var i, + arr = tarteaucitron.user.adsensepremiumArr.split(','); + + GS_googleAddAdSenseService(tarteaucitron.user.adsensepremium); + GS_googleEnableAllServices(); + for (i = 0; i < arr.length; i += 1) { + GA_googleAddSlot(tarteaucitron.user.adsensepremium, arr[i]); + } + GA_googleFetchAds(); + clearInterval(timer); + } else if (increment >= 100) { + clearInterval(timer); + } + }, 10); + } +}; + // google adsense search (form) tarteaucitron.services.adsensesearchform = { "key": "adsensesearchform",