Skip to content

Instantly share code, notes, and snippets.

@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@sahava
sahava / allowlinker-ga.js
Last active December 29, 2023 09:11
This script reproduces Google Analytics' allowLinker plugin, resulting in a function that returns true if the linker parameter in the URL is valid and false otherwise. Uses the "old" linker plugin format. You can also pass a string as an argument to check if that string is a valid linker parameter.
var checkLinker = function(str) {
// First browser fingerprint method.
// Uses the clientId / gid string, user agent, time, and browser plugin descriptions.
var joiner = function (cidGid, offset) {
var a = new Date,
b = window.navigator,
c = b.plugins || [];
var d = [cidGid, b.userAgent, a.getTimezoneOffset(), a.getYear(), a.getDate(), a.getHours(), a.getMinutes() + offset];
for (var e = 0; e < c.length; ++e) {
@grantstephens
grantstephens / Flashing OpenWRT.md
Last active November 5, 2023 10:21
TP-Link TL-WR902AC v3 OpenWRT Setup

Important Links:

Flash instruction:

The only way to flash LEDE image in TL-WR902AC v3 is to use tftp recovery mode in U-Boot:

  1. Configure PC with static IP 192.168.0.66/24 and tftp server.
  2. Rename "openwrt-ramips-mt76x8-tplink_tl-wr902ac-v3-squashfs-tftp-recovery.bin" to "tp_recovery.bin" and place it in tftp server directory.
@BrainlabsDigital
BrainlabsDigital / Domain Name Checker.js
Created April 3, 2018 09:44
Script to find if any ads or keywords have landing pages with the wrong domain.
/**
*
* Domain Name Checker
*
* This script will scan through your keyword and ad URLs, checking the domain
* names for anything out of place, and output any discrepancies it finds into a
* Google Sheet.
*
* Version: 1.0
* Google AdWords Script maintained on brainlabsdigital.com
/* Put Google Ads Data in Google Spreadsheet
* -----------------------------------------
*
* Script by Optmyzr.com
*
* v3 (20190702)
* - updated to API v201809
* v2 (20180810)
* - updated to newer reporting version in ads API
*
@BrainlabsDigital
BrainlabsDigital / Copy Labels Between Keywords and Ads.js
Created December 15, 2017 17:52
Copies labels from ads to keywords in the same ad group, or from keywords to ads.
/**
* Copying Labels From Keywords To Ads Or Vice-Versa
*
* If a certain percentage of keywords (or ads) are labelled with a particular
* label within an ad group, the script applies the label to all ads (or
* keywords) in that ad group.
*
* Version: 1.0
* Google AdWords Script maintained on brainlabsdigital.com
*/
@mhawksey
mhawksey / face-detection-to-google-analytics.py
Last active January 16, 2020 21:40
Snippet of code used for DevFest London 2017 to count faces in audience and send to Google Analytics (see https://mashe.hawksey.info/?p=17787)
import io
import picamera
import cv2
import numpy
def hitGA(faces):
print("Sending to GA")
requests.get("http://www.google-analytics.com/collect?v=1" \
+ "&tid=YOUR_UA_TRACKING_ID_HERE" \
+ "&cid=1111" \
@feimosi
feimosi / persist-restore-form-data.js
Last active December 10, 2020 16:10 — forked from CezaryDanielNowak/gist:85302c1d3323e951e3885bcedaa7c10b
Persist / restore form data using localStorage
// Persist data:
localStorage._formData_ = JSON.stringify(Array.from(document.forms[0].querySelectorAll('input')).map((el) => el.value));
// Restore data:
_formData_ = JSON.parse(localStorage._formData_) || [];
Array.from(document.forms[0].querySelectorAll('input')).forEach((input, id) => {
input.value = _formData_[id];
var event = document.createEvent("HTMLEvents");
event.initEvent("input", true, true);
input.dispatchEvent(event);
@IronistM
IronistM / data_layer_console_dump.js
Created September 19, 2016 08:31
Browser console dump of Google Tag Manager data layer (source : http://pastebin.com/xyFGz54n via Julien coquet)
// Paste this in browser console to dump your Google Tag Manager dataLayer object
var buffer="\n";
for (var i in dataLayer){
for (var j in dataLayer[i]){
buffer += j+":"+dataLayer[i][j]+"\n";
}
}
console.trace(buffer)
@russorat
russorat / keyword_cleanup_full.js
Last active July 27, 2019 20:23
The full Keyword Cleanup Script from my SearchEngineLand.com post. Be sure to change the email on line 30. See the blog post for more details.
function main() {
var config_options = {
'default' : {
metric : 'Conversions', // This metric will be used for determining duds
threshold : 0, // Duds are less than or equal to this threshold
days_ago : 90, // The timeframe of the data to consider, days ago to yesterday
days_in_limbo : 5 // The script will warn you for this many days before deleting something
}
// If you want, you can add account specific configurations too. If an account specific config
// is not found, the default one from above is used.