Skip to content

Instantly share code, notes, and snippets.

@Shoora
Shoora / jquery.gaformanalysis.js
Last active April 21, 2019 18:35 — forked from hidesakai/jquery.gaformanalysis.js
jquery.gaformanalysis
var gaForm = gaForm || {};
jQuery(function($) {
var defaults = {
Forms:"#form",
Category:"analysisForm",
Action:"id",
inputRadio: true,
inputSelect: true,
inputCheckBox: true
};
@Shoora
Shoora / Tracker.js
Last active February 28, 2019 03:59 — forked from juriansluiman/Tracker.js
Create a Tracker module for Google Analytics This tracker enables to track clicks on links and submits on forms. Usually * these events will not be recorded as the window.location is changed and the * request to Google Analytics is cancelled. This module prevents default * behaviour, tracks the Google Analytics event and then continues the link/…
/**
* Create a Tracker module for Google Analytics
*
* This tracker enables to track clicks on links and submits on forms. Usually
* these events will not be recorded as the window.location is changed and the
* request to Google Analytics is cancelled. This module prevents default
* behaviour, tracks the Google Analytics event and then continues the link/submit.
*
* Data attributes are used to augment the event with category/action/label values.
* Use them as "data-track-category", "data-track-action" and "data-track-label".
@Shoora
Shoora / analytics.ajax.html
Last active February 28, 2019 03:26 — forked from joseadrian/analytics.ajax.html
analytics.ajax.html
<!--
Ejemplo:
Página: dominio/formulario
API: analytics.js
-->
<script>
(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)
@Shoora
Shoora / form-submit-tracking-1.js
Last active February 28, 2019 03:38 — forked from andregoncalves/form-submit-tracking-1.js
form-submit-tracking-1
$("form").on('submit', function(e) {
var form = this;
if (_gaq) {
e.preventDefault();
_gaq.push(['_trackEvent', 'my category', 'my action']);
setTimeout(function() { form.submit(); }, 100);
return false;
}
@Shoora
Shoora / gist:68a77aa863ce3e379425
Last active February 28, 2019 03:41 — forked from padicode/gist:5318608
I modified the script to make it work with the new analytics.js - Universal Analytics that Google Analytics is due to launch in 2013. I also added minor changes to the logic. Any suggestions for optimization are welcomed
<script>
/*
The original script for the current Google Analytics tracking code is provided by Justin Cutroni: http://cutroni.com/blog/2012/02/21/advanced-content-tracking-with-google-analytics-part-1/
I modified the script to make it work with the new analytics.js - Universal Analytics that Google Analytics is due to launch in 2013.
I also added minor changes to the logic. Any suggestions for optimization are welcomed.
*/
jQuery(function($) {
// Debug flag
var debugMode = false;
@Shoora
Shoora / jquery.link-tracking-ga.js
Last active February 28, 2019 03:47 — forked from simondahla/jquery.link-tracking-ga.js
jquery.link-tracking-ga
@Shoora
Shoora / new.js
Last active February 28, 2019 03:50 — forked from tomfuertes/new.js
GA Helper Functions
//Helper Functions
(function(window, document, undefined) {
window.gaGetParameterByName = function(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
};
window.gaGetElementsByClassName = function(e) {
var tags = this.all || this.getElementsByTagName('*');
@Shoora
Shoora / Bookmarklets.js
Last active April 23, 2023 03:56 — forked from heavensrevenge/gist:712735
Bookmarklets
javascript:function tinycc_bookmarklet(){var script=document.createElement('script');script.src='http://tiny.cc/public/javascript/bookmarklet.js';scriptObj=document.body.appendChild(script);}tinycc_bookmarklet();
javascript:void(window.open('http://3.ly/?bm=1&u='+encodeURIComponent(location.href)))
javascript:(function(){var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://identi.ca//index.php?action=bookmarklet',l=d.location,e=encodeURIComponent,g=f+'&status_textarea=%E2%80%9C'+((e(s))?e(s):e(document.title))+'%E2%80%9D%20%E2%80%94%20'+e(l.href);function%20a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=450,height=200')){l.href=g;}}a();})()
javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){location.
@Shoora
Shoora / bookmarklet.js
Created May 17, 2016 00:56 — forked from fiatjaf/bookmarklet.js
the bookmarklet bookmarklet
function getJSON (url, callback) {
var xhr;
xhr = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (callback) {
callback(xhr.responseText);
}
}
};
@Shoora
Shoora / example.html
Last active February 28, 2019 03:37 — forked from mrzlodey/example.html
load font localStorage
<head>
...
<script>
(function(){
function addFont() {
var style = document.createElement('style');
style.rel = 'stylesheet';
document.head.appendChild(style);
style.textContent = localStorage.sourceSansPro;
}