Skip to content

Instantly share code, notes, and snippets.

@LCHCAPITALHUMAIN
LCHCAPITALHUMAIN / import_json_appsscript.js
Created September 24, 2017 07:35 — forked from chrislkeller/import_json_appsscript.js
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save.
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@LCHCAPITALHUMAIN
LCHCAPITALHUMAIN / GoogleAnalyticsReportingSample.java
Created May 18, 2020 11:48 — forked from LindaLawton/GoogleAnalyticsReportingSample.java
Sample for the Google Analytics reporting API with java
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.store.DataStoreFactory;
@LCHCAPITALHUMAIN
LCHCAPITALHUMAIN / dataLayerHistory.js
Created May 22, 2020 07:55 — forked from sahava/dataLayerHistory.js
JavaScript for persisting dataLayer array and data model composition across pages
(function() {
// Set the timeout for when the dataLayer history should be purged. The default is 30 minutes.
// The timeout needs to be in milliseconds.
var timeout = 30*60*1000;
// Change dataLayerName only if you've defined another named for the dataLayer array in your
// GTM container snippet.
var dataLayerName = 'dataLayer';
// Don't change anything below.
function() {
return function(model) {
var globalSendTaskName = '_' + model.get('trackingId') + '_sendHitTask';
// Hook the sendHitTask - grab an original reference to a function
var originalSendTask = window[globalSendTaskName] = window[globalSendTaskName] || model.get('sendHitTask');
model.set('sendHitTask', function(sendModel) { //overwrite sendHitTask with our code
var hitPayload = sendModel.get('hitPayload');
@LCHCAPITALHUMAIN
LCHCAPITALHUMAIN / brokenlinks.js
Created October 5, 2020 09:26 — forked from robinwo/brokenlinks.js
Find broken links (AdWords)
;(function(u){
/**
* @desc Map your OneTrust tag IDs here to Tealium Template IDs found in utag.loader.cfg object like this:
* @param "OneTrust_tag_id": "Tealium_tid",
* @return You can add more lines to suit your tag library in both tools
*/
// Begin Config
var oneTrustTagIdToTealiumTemplateIdConfig = {
"81878": "7110", // e.g.: Google Analytics
@LCHCAPITALHUMAIN
LCHCAPITALHUMAIN / Application.cfc
Created January 4, 2021 10:51 — forked from christierney402/Application.cfc
CF: Using "Access-Control-Allow-Origin" header in ColdFusion CFScript #snippet
component {
boolean function onRequestStart( required string targetPage ) {
var headers = getHttpRequestData().headers;
var origin = '';
var PC = getpagecontext().getresponse();
// Find the Origin of the request
if( structKeyExists( headers, 'Origin' ) ) {
@LCHCAPITALHUMAIN
LCHCAPITALHUMAIN / attach-listener-to-push-method.js
Created January 16, 2021 18:25 — forked from baybatu/attach-listener-to-push-method.js
Attach event listener to Array push method call
var eventify = function(arr, callback) {
arr.push = function(e) {
Array.prototype.push.call(arr, e);
callback(arr);
};
};
var array = [1,2,3];
eventify(array, function(newArray) {
@LCHCAPITALHUMAIN
LCHCAPITALHUMAIN / pii_removal_tag.html
Created June 7, 2021 11:06 — forked from SNemzer/pii_removal_tag.html
Custom HTML tag for GTM to strip PII from titles and URLs
<script>
//Extract Parameters into array
function extractParams() {
var urlParams = {},
match,
search = /([^&=]+)=?([^&]*)/g,
query = window.location.search.substring(1);
while (match = search.exec(query)) {
urlParams[match[1]] = match[2];
}
@LCHCAPITALHUMAIN
LCHCAPITALHUMAIN / javascript-query-string.js
Created June 7, 2021 11:07 — forked from DavidWells/javascript-query-string.js
JavaScript :: Regex trick: Parse a query string into an object
// http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
// JavaScript regex trick: Parse a query string into an object
var queryString = {};
anchor.href.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) { queryString[$1] = $3; }
);
// Usage