Skip to content

Instantly share code, notes, and snippets.

@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.
@BrainlabsDigital
BrainlabsDigital / Search Query Mining Tool.js
Last active October 30, 2024 22:18
Search Query Mining Tool script to calculate the performance of n-grams
/**
*
* Search Query Mining Tool
*
* This script calculates the contribution of each word or phrase found in the
* search query report and outputs a report into a Google Doc spreadsheet.
*
* Version: 2.2
* Updated 2015-09-17: replacing 'KeywordText' with 'Criteria'
* Updated 2016-10-11: replacing 'ConvertedClicks' with 'Conversions'
@vhsu
vhsu / Lazy Load Google Remarketing & Conversion Javascript Module.js
Last active October 25, 2018 20:05
Google Adwords Asynchronous Remarketing Javascript Module - Lazy Loading Adwords Conversion Code
// This module can be used to trigger the Google Adwords remarketing or conversion tag asynchronously only when you need it (lazy loading) without loading unused ressources
// Mostly useful when the Google Remarketing tag or Conversion tag is triggered only on specific conditions.
// Author : Vincent Hsu -> twitter.com/suisseo -> http://www.suisseo.ch
// Language : Javascript
// Usage : googremarketing.loadTag(conversionid, conversionlabel)
// Start Google Remarketing Module
var googremarketing = (function() {
var asyncload = 0;
// Load Async Google Adwords remarketing code
function Gremloader() {
@tomayac
tomayac / remoteStorage_adWordsScripts.js
Last active October 29, 2019 12:37
Remote Storage for AdWords Scripts
/**
* @author Thomas Steiner ([email protected])
* @license CC0 1.0 Universal (CC0 1.0)
*
* Provides a simple key-value storage API modeled closely after
* the localStorage API in Web browsers, but tailored to AdWords Scripts.
* AdWords Scripts, due to execution time limits published at
* https://developers.google.com/adwords/scripts/docs/limits,
* forces users to store the state of a given script using either labels
* (https://developers.google.com/adwords/scripts/docs/tips#labels), or
@audreyfeldroy
audreyfeldroy / gist:5e37281b38bc27aa7e26
Last active August 1, 2020 13:53
How to remove embarrassing commits that you just made to a public Git repo

Warning: This can be really bad to do. It changes your git history, which is bad and could affect other remotes. Don't do this to a project that other people are using too. Now that you've been warned, here's how to do some bad things to your repo. Do it quickly before anyone notices.

Roll back 1 commit locally:

git reset --hard HEAD~1

Roll back 6 commits locally:

git reset --hard HEAD~6
@Olical
Olical / binary-search.js
Last active October 18, 2020 15:16
JavaScript binary search with the same API as indexOf. Performance: http://jsperf.com/binaryindexof-and-indexof
/**
* Performs a binary search on the host array. This method can either be
* injected into Array.prototype or called with a specified scope like this:
* binaryIndexOf.call(someArray, searchElement);
*
* @param {*} searchElement The item to search for within the array.
* @return {Number} The index of the element which defaults to -1 when not found.
*/
function binaryIndexOf(searchElement) {
'use strict';
@mhawksey
mhawksey / gist:1276293
Last active February 28, 2025 08:52
Google App Script to insert data to a google spreadsheet via POST or GET - updated version as per https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software