Skip to content

Instantly share code, notes, and snippets.

@DanWilkerson
DanWilkerson / gist:a90684b2491947ce31b61809421a8dc8
Created October 11, 2016 18:16
Google Analytics Client ID Generator
/**
* Generates a client ID in the format historically used by the Google Analytics
* JavaScript libraries. Note that any alphanumeric value may be used, but
* ideally each should be unique to a given client.
*
* More information on Client IDs:
* https://developers.google.com/analytics/devguides/collection/protocol/v1/email#client-id-cid
*/
function generateGaClientId() {
/*******************************
* Automatically adds any new keywords in your
* Alpha campaigns as exact match negatives in
* the corresponding Beta campaign. Also handles
* pausing or removing keywords in your Alpha campaign
* and removing the corresponding negative in your Beta.
*******************************/
// Just as before, these strings will be
// used to identify your Alpha and Beta campaigns.
// This script assumes that your Alpha campaigns are
@revolunet
revolunet / lzw_encoder.js
Created February 25, 2011 14:55
LZW javascript compress/decompress
// LZW-compress a string
function lzw_encode(s) {
var dict = {};
var data = (s + "").split("");
var out = [];
var currChar;
var phrase = data[0];
var code = 256;
for (var i=1; i<data.length; i++) {
currChar=data[i];