Outils pour utilisateurs

Outils du site


Panneau latéral

webdev:api:google_shit

Google shits

Analytics

Admin - Code

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).

(function(w,d,s,l,i)
{
	w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});
	var f=d.getElementsByTagName('head')[0],
	j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';
	j.async=true;j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;
	f.appendChild(j);
})(window,document,'script','dataLayer','GTM-XXXXXXX');

Google Tag manager

Charger analytics en asynchrone

Doc

Gmaps

Doc Maps - Basic - Pricing

You need a credit card to link any google map now + if you go above the quota you have to pay them 🖕
AND if you give them any credit card info they refuse to delete them + they register them for your personal google account as well AND YOU CAN'T DELETE THIS ONE EITHER
I'll send them an email mentioning how that's illegal and contrary to what their help say to see how they react. I might sue them as well…

Actually you need to delete the whole Google pay thing, and then it's fine.

	<div id="gmap"></div>

	<script>
	// Initialize and add the google map
	function initMap() 
	{
		var adress = {lat: 45.413250, lng: -0.460379};
		var map = new google.maps.Map(document.getElementById('gmap'), {zoom: 11, center: adress});
		var marker = new google.maps.Marker({position: adress, map: map});
	}
	</script>
	<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAyHMWgqFzePVvGzc8ZxGvTfKwx3CJrLJo&callback=initMap"></script>

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” → Click on the banner at the bottom, and then copy the coordinates on the left (they don't allow direct copy)

Ajouter une adresse propre (Geocoding) : Doc - Prix

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'avoir des factures à payer à google : fuck them

Version iframes

Ouvrir gmaps et une adresse, puis faire “Partager” → Intégrer une carte
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.

webdev/api/google_shit.txt · Dernière modification: 02/09/2019 18:59 de dolo