Skip to content

Instantly share code, notes, and snippets.

View googleanalyticsresoneo's full-sized avatar

RESONEO Google Analytics googleanalyticsresoneo

View GitHub Profile
<!-- Regexp to recognize fake trafic from JS enabled crawlers
For use in Google Analytics **Filters** on the "ISP Organization" field, corresponding dimension in reporting is "Service Provider"
This lists fits within the 255 characters limit (!doesn't any more, to be optimized) of the filter field if you want to have a Profile/View that will include only that traffic
Most crawlers have Java disabled
You can also disable logging the activity of web monitoring services through a test on user-agent string, see https://gist.github.com/googleanalyticsresoneo/964266
-->
@googleanalyticsresoneo
googleanalyticsresoneo / google analytics exclude consumer ISP
Last active October 6, 2015 06:57
noms des FAI les plus courants
<!-- Regexp to recognize traffic from consumer ISP in Google Analytics
If you exclude those, you get a list of business organizations visiting your Web site
Beware to the length of this list
-->
pool\s?|bloc\s?|proxad|cable|free s|radiotel|orange|.?dsl|tele[kc]+om|tele[phf]+o|video|mobile|wireless|broadband|internet|fibre| ip |gprs|provider|[a-z ]+[0-9]+[a-z ]+|obs cu|\(not set\)|network|static ip|^test$|host(ing|ed)|isp|backbone|dhcp|ip address|dynamic|dialup|server|platform|inap z|completel|jet ?multi|users|aol|rue louvrex 95|brutele sc$|telenet|p&t|fttx|ovh (sas|sys)|verizon|online|belgacom|swisscom|psinet|nordnet|colt|citevision|service nsaii$|inktomi|yahoo|consumer
@googleanalyticsresoneo
googleanalyticsresoneo / ga-addthis.html
Last active October 5, 2015 22:27
AddThis and Google Analytics integration Async Syntax
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!--
AddThis integration with Google Analytics Async - (c) 2013 analytics (chez) resoneo (point) com
https://gist.github.com/googleanalyticsresoneo/2887422
see http://support.addthis.com/customer/portal/articles/1293805-using-addthis-asynchronously
@googleanalyticsresoneo
googleanalyticsresoneo / ga-fields.css
Last active September 30, 2015 15:37
Custom CSS to expand input fields in Google Analytics configuration interface
/*
Expands the width of input fields in the GA v5 Interface
use within the Firefox Stylish extension
https://addons.mozilla.org/en-US/firefox/addon/stylish/?src=external-userstyleshome
or Google Chrome Stylish extension
https://chrome.google.com/webstore/detail/fjnbnpbmkenffdnngjfgmeleoegfcffe
initial code from Olaf Calderon <@blastam.com>
owner Olivier VIT @ resoneo.com
@googleanalyticsresoneo
googleanalyticsresoneo / urchin_notprovided.js
Created November 17, 2011 12:40
not provided keyword upgrade for urchin.js
/*! handling of secure google search keyword being hidden and set as (not provided) for Google Analytics sites using urchin.js , not ga.js
* see also : http://googleblog.blogspot.com/2011/10/making-search-more-secure.html
* Google handles it only in ga.js, we provide it for sites using urchin.js
* author : analytics(at)resoneo(dot)com 2011
* https://gist.github.com/1373049
* usage : include urchin.js ABOVE this code, set your parameters and call urchinTracker BELOW this code */
/*jslint browser: true, sloppy: true, vars: true, white: true, nomen: true, maxerr: 50, indent: 4 */
/* adding some search engines */
@googleanalyticsresoneo
googleanalyticsresoneo / track_exception_through_events.js
Created August 3, 2011 14:52
JS Exceptions tracked in GA Events
function trackErrorThroughEvent(exception, fct) { /* remontée des erreurs éventuelles pour détection des pbs */
_gaq.push(['_trackEvent', 'Erreur JS ' + (fct || 'native'), exception + ' name: ' + (exception.name || 'Error') + ' #mess: ' + (exception.message || 'n/a') + ' #nav: ' + navigator.userAgent , ' #url: ' + document.location.href + '#ref: ' + document.referrer ,,true ]);
}
@googleanalyticsresoneo
googleanalyticsresoneo / log.conf
Created June 7, 2011 13:51
Apache logging conf
#Format spécifique : vhost,time,request protocol,final response code,request URI,response size,user-agent
LogFormat "\"%v\",\"%t\",\"%H\",\"%>s\",\"%r\",\"%b\",\"%{User-Agent}i\"" vhosts-bots
# Conditionne le log en fonction du user-agent
SetEnvIf User-agent Googlebot isabot
SetEnvIf User-agent Slurp isabot
SetEnvIf User-agent msnbot isabot
CustomLog "logs/site_access_isabot.txt" vhosts-bots env=isabot
@googleanalyticsresoneo
googleanalyticsresoneo / ignoreregexp.js
Created May 27, 2011 16:41
Ignorer des referrals sur la base d'une regexp
/* http://www.roirevolution.com/blog/2011/01/google_analytics_subdomain_tracking.php */
/* Ignorer les possibles affluents sur des domaines matchant une regex */
try{
if ( /vols\d{0,2}\.thomascook\.fr|www\.thomascook\.fr|booking\.thomascook\.fr|enwi\.norrisdata\.net|ypsilon\.net/.exec(document.referrer) ) { _gaq.push(['_addIgnoredRef', document.referrer.split('/')[2].split('.')[1]]); } } catch(e){}
@googleanalyticsresoneo
googleanalyticsresoneo / ga-async-seo-france.html
Last active September 25, 2015 18:18
Marquage GA asynchrone complet pour projet SEO marché français
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<!-- a la fin du head -->
<script type="text/javascript">
/*! marquage GA asynchrone de base pour projets SEO en France (c) analytics (chez) resoneo (point) com - 2013
fork it on https://gist.github.com/googleanalyticsresoneo/964266
*/
/* moteurs déjà présents dans ga.js 5.3.8
@googleanalyticsresoneo
googleanalyticsresoneo / google_image.html
Created May 2, 2011 15:04
Détection des mots clef pour le trafic en provenance de Google Image
<!-- exemple de referral depuis le 22 juillet 2011
http://www.google.fr/imgres?q=resoneo&um=1&hl=fr&sa=N&biw=1260&bih=832&tbm=isch&tbnid=oHqMFLKPHlmBuM:&imgrefurl=http://www.boitedeveille.fr/tag/resoneo/&docid=Hy5kqj7oMth2tM&w=191&h=82&ei=9kU4TtyKGcOs8gOq--z7Ag&zoom=1&iact=hc&vpx=602&vpy=176&dur=8629&hovh=65&hovw=152&tx=64&ty=32&page=1&tbnh=65&tbnw=152&start=0&ndsp=23&ved=1t:429,r:2,s:0
-->
<script type="text/javascript">
// now as a standard syntax
_gaq.push(['_addOrganic', 'google', 'q', true, 'google images', '/imgres?']);
</script>