Skip to content

Instantly share code, notes, and snippets.

@therobinkim
therobinkim / Readme.md
Last active August 29, 2015 14:05
Prefix Demo

This is my implementation of a prefix tree that is used to give you autocompletion suggestions!

The dictionary has been prepopulated with approximately 5,000 common English words.

Find me at http://therobinkim.com/!

@hidesakai
hidesakai / jquery.gaformanalysis.js
Created October 3, 2012 14:43
フォーム内容をGAトラックイベントへPush
var gaForm = gaForm || {};
jQuery(function($) {
var defaults = {
Forms:"#form",
Category:"analysisForm",
Action:"id",
inputRadio: true,
inputSelect: true,
inputCheckBox: true
};
@andregoncalves
andregoncalves / form-submit-tracking-1.js
Created October 27, 2012 10:35
Analytics form submit tracking 2
$("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;
}
@mir4a
mir4a / KIA PARSER
Last active December 18, 2015 14:09
очередной букмарклет парсер, но уже для kia.ua
javascript:
/**
* простой букмарклет, который парсит фотки из http://www.kia.ua/
*/
(function () {
var a = document.querySelectorAll("#thumbs .thumbs .thumb");
var docHeight = document.height;
/**
* Создаю фон прелоадера
* @type {*}
@lluchs
lluchs / dltrack.js
Created July 6, 2013 15:47
Tracks downloads via GA events.
/* Downloads tracking */
jQuery(function() {
var dlr = /\.(?!html?|php)(\w{1,4})$/
jQuery('a').click(function() {
var m
if (typeof(ga) == 'function' && (m = dlr.exec(this.href))) {
ga('send', 'event', 'download', m[1], this.href)
}
})
@trumball
trumball / paragraph
Created September 9, 2013 14:26
Paragraph padding and indent
p{
margin-bottom:20px;
}
p+p{
text-indent:2em;
margin-top:-20px;
}
jQuery(document).ready(function($){
$('form').submit(function(event){
//if analytics object exists
if(window._gat){
event.preventDefault();
optinForm = this;
_gaq.push(['_set','hitCallback', function(){
optinForm.submit();
}]);
_gaq.push(['_trackEvent', 'Forms', 'Submit', 'hbsanewtraffic']);
@pseudosavant
pseudosavant / AutoCacheQueries.js
Last active March 30, 2016 21:44
Automatically cache your DOM queries using a wrapper function like this.
// jQuery wrapper
var cacheQuery = function(query) {
this.cache = this.cache || {};
if (!this.cache[query]) {
this.cache[query] = jQuery(query);
}
return this.cache[query];
};
@mohsinrasool
mohsinrasool / track-ga-click-event-gravityforms.php
Last active May 9, 2016 22:27
Track google analytics click event in in Gravity Forms
<?php
// track conversions in Gravity Forms
function add_conversion_tracking_code($button, $form) {
$dom = new DOMDocument();
$dom->loadHTML($button);
$input = $dom->getElementsByTagName('input')->item(0);
if ($input->hasAttribute('onclick')) {
$input->setAttribute("onclick","ga('send', 'click', 'submit');".$input->getAttribute("onclick"));
} else {
@rbg246
rbg246 / check-for-google-analytics-id.js
Created November 30, 2015 09:28
Prints a list of universal analytic ids found on a site
function checkAnalytics () {
var ids = ga.getAll();
var len = ids.length;
console.log('Universal Analytics');
console.log('ids', ids);
console.log('=======================================================');
console.log('Number of Universal Analytics IDs found : ' + ids.length);
console.log('=======================================================');
console.log('Universal Analytics IDs');
console.log('=======================================================');