Qalabka xaqiijinta sida W3C Markation Service Validation Service ama Google PageSpeed Insights ayaa waxtar leh si qiimeyn leh u qiimeynaya lambarka iyo waxqabadka bogga. Google gaar ahaan waxay saameyn ku yeelataa warshadaha oo dhan fikradaha sida kor ku xusan - waxayna sidoo kale bixisaa tilmaamo adag laakiin faa'iido leh oo ku saabsan isku-dhafka iyo kaydinta sawirka. Si kastaba ha noqotee, way dhici kartaa in Google uu cagaha ku maro.
Doono lambarka raadinta JavaScript
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-12350231-1', 'auto'); ga('send', 'pageview');
Isku-darka Google Analytics ee bogga sida rasmiga ah loogu sharraxay , Google waxay ka cabaneysaa la'aanta kaydinta biraawsarka:
Nasiib darrose, farsamo ahaan tan waxaa kaliya oo lagu sixi karaa cidda martida u ah faylka, xaaladdan Google lafteeda, oo waxaa suurtagal ah oo keliya in lagu xalliyo hanaankan soo socda: Marka hore waxaad foorartaa URL
(window,document,'script','//www.google-analytics.com/analytics.js','ga');
aad server u gaar ah
(window,document,'script','analytics.js','ga');
oo waxay dejisaa shaqo fudud oo fudud iyada oo loo marayo PHP, oo soo dejisa faylalka ugu dambeeyay .js ee cusub oo loogu talagalay server-keeda maalin kasta.:
file_put_contents("analytics.js", fopen("https://www.google-analytics.com/analytics.js", 'r'));
Markaa waad sifiican u hagaajin kartaa kaydinta si BoggaSpeed uusan mar dambe u dhaliilin qaladka: