Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
webdev:api:google_shit [21/08/2017 14:30] dolo |
webdev:api:google_shit [02/09/2019 18:59] dolo [Google shits] |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== Google shits ====== | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | ===== Analytics ===== | ||
+ | [[http:// | ||
+ | |||
+ | Ajouter un accès pour un compte tiers : Admin (en bas à gauche) -> Colonne 1 : Gestion des utilisateurs | ||
+ | ===== Google Tag Manager ===== | ||
+ | Pretty much shit, unless you're in marketing. | ||
+ | |||
+ | The scripts included by GTM are added before the first script in the page. So with the //plans de marquages// where we **have to** put some script before the gtm js we can't make it work. | ||
+ | |||
+ | **Solution :** change the way the GTM js is called. The following code append the gtm into the head (it's supposed to be at the end but only goes just after the js which call it, but that still work). | ||
+ | |||
+ | <code linenums> | ||
+ | (function(w, | ||
+ | { | ||
+ | w[l]=w[l]||[]; | ||
+ | var f=d.getElementsByTagName(' | ||
+ | j=d.createElement(s), | ||
+ | j.async=true; | ||
+ | f.appendChild(j); | ||
+ | })(window, | ||
+ | </ | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ===== Charger analytics en asynchrone ===== | ||
+ | [[https:// | ||
+ | |||
+ | ===== Gmaps ===== | ||
+ | [[https:// | ||
+ | |||
+ | You need a credit card to link any google map now + if you go above the quota you have to pay them 🖕\\ | ||
+ | < | ||
+ | I'll send them an email mentioning how that's illegal and contrary to [[https:// | ||
+ | Actually you need to delete the whole [[https:// | ||
+ | |||
+ | <Code linenums> | ||
+ | <div id=" | ||
+ | |||
+ | < | ||
+ | // Initialize and add the google map | ||
+ | function initMap() | ||
+ | { | ||
+ | var adress = {lat: 45.413250, lng: -0.460379}; | ||
+ | var map = new google.maps.Map(document.getElementById(' | ||
+ | var marker = new google.maps.Marker({position: | ||
+ | } | ||
+ | </ | ||
+ | <script async defer src=" | ||
+ | </ | ||
+ | |||
+ | To get the GPS coordinates for the marker, go into google maps, right click **exactly** where you want it and click "Plus d'info sur cet endroit" | ||
+ | |||
+ | Ajouter une adresse propre (Geocoding) : [[https:// | ||
+ | |||
+ | **Les maps avec javascript sont plus chiante à mettre en place et n'ont en général aucun avantage sur celles en iframes pour des trucs simples, mais elles créent un risque d' | ||
+ | |||
+ | === Version iframes === | ||
+ | Ouvrir gmaps et une adresse, puis faire " | ||
+ | Le niveau de zoom est enregistré donc bien cadrer avant de le faire. On peut modifier la largeur dans le html généré et un width en %tage fonctionne. | ||
+ | |||