Open a URL using Google Apps Script without requiring additional user interaction.
Code also on StackOverflow.
# Create an OAuth consumer with write access. | |
# For a callback URL, you can use: `https://www.google.com/` | |
# https://bitbucket.org/account/user/USERNAME/oauth-consumers/new | |
# Optional: Hardcode username, client key, and client secret into script. | |
# (but be aware of the danger of hardcoding credentials into any code!!) | |
# (if skipped, the script will securely prompt for info). | |
# Edit values | |
NEW_REPO_USER_OR_ORG="editme" |
(function(){ | |
var aI, pI, vI, a, p, v, rows = [], row; | |
for( aI = 0; aI<window.preload.accounts.length; aI++ ){ | |
row = []; | |
a = window.preload.accounts[aI]; | |
for( pI = 0; pI<a.wprops.length; pI++ ){ |
Open a URL using Google Apps Script without requiring additional user interaction.
Code also on StackOverflow.
<script>(function(){ | |
/* | |
This script is an alternative to the 'Add JavaScript API support to all YouTube videos' | |
setting in GTM's YT trigger. GTM's YT trigger will not load the YT API if no videos are | |
present at page load (it does add the enablejsapi param to dynanmically inserted videos, | |
but it will not load the YT API js). This script, on the other hand, should work in all cases. | |
*/ | |
if( window.YT ) return; | |
Useful for preventing PII from being tracked.
Usage:
page_location
={{Page URL (PII Stripped)}}.page
={{UA Pageview URL (PII Stripped)}} and location
={{Page URL (PII Stripped)}}./** | |
* @function onDomInsert - Listener for nodes inserted into DOM. | |
* Does NOT monitor when things are removed. | |
* Based on http://stackoverflow.com/a/14570614/445295 | |
* @param [DOMNode] el - Optional. The element to listen on. Defaults to document. | |
* @param [Function] cb - Callback. Called with inserted element as only arg. | |
*/ | |
var onDomInsert = (function(){ | |
'use strict'; | |
<script> | |
/** | |
* Data layer pushes should always have an event (even in simple <head> snippets). | |
* But if you're dealing with an event-less push upon which you need to be able | |
* to fire a Trigger, and you cannot change the push snippet, this code will | |
* let you detect the push and add an event dynamically. | |
* | |
* Tested in Chrome, Firefox, and IE9. | |
*/ | |
(function(){ |
<script> | |
/** | |
* This script facilitates cross-domain tracking when one site is runs | |
* GA Universal and another runs legacy GA (Traditional or Async/Classic). | |
* | |
* This integration currently unilateral, working only for users | |
* navigating from Universal > Legacy. For example: if a user clicks | |
* on a paid ad and lands directly on your asset/platform (legacy), | |
* then goes to your main site (UA), then clicks back to your asset/platform | |
* and converts, it will be tracked as two users: one that bounced from a |