Skip to content

Instantly share code, notes, and snippets.

@philbar
philbar / AdWords_Scripts_Ad_Testing.js
Last active August 29, 2015 14:00 — forked from russorat/AdWords_Scripts_Ad_Testing.js
Replace Visitor Threshold with Chi-Squared test
/*********************************************
* Automated Creative Testing With Statistical Significance
* Version 2.1
* Changelog v2.1 - Replace Visitor Threshold with Chi-Squared test
* Changelog v2.0
* - Fixed bug in setting the correct date
* - Script now uses a minimum visitors threshold
* per Ad instead of AdGroup
* - Added the ability to add the start date as a label to AdGroups
* - Added ability to check mobile and desktop ads separately
/*********************************************
* Automated Creative Testing With Statistical Significance
* Version 2.0
* Changelog v2.0
* - Fixed bug in setting the correct date
* - Script now uses a minimum visitors threshold
* per Ad instead of AdGroup
* - Added the ability to add the start date as a label to AdGroups
* - Added ability to check mobile and desktop ads separately
* Changelog v1.1.1 - Fixed bug with getDisplayUrl
<script>
function controlVariant() {
dataLayer.push({'event': 'google'});
return variantOne;
}
function testVariant() {
dataLayer.push({'event': 'adroll'});
return variantTwo;
}
@philbar
philbar / adwords-script.js
Created June 12, 2014 19:54
Track AdWords Quality Score with Google Analytics
***********************************************
*v. 1.6 updated 02062014
* Credits:
* Alexey Chesnok google.com/+AlexeyChesnok
* Based on:
* Quality score calculator by Frederick Vallaeys at Optmyzr
* http://www.optmyzr.com/scripts Buy his Scripts, they are awesome!
* License http://creativecommons.org/licenses/by-nc/4.0/deed.en_US
* and google analytics beacon by Russell Savage
* http://www.freeadwordsscripts.com/2013/11/track-adwords-script-runs-with-google.html
@philbar
philbar / gist:880285d3655981c94b84
Last active August 29, 2015 14:11
geolocation.html
<script type="text/javascript" src="//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js"></script>
<script type="text/javascript">
var onSuccess = function(location){
vLat = location.location.latitude;
vLon = location.location.longitude;
vCty = location.city.names.en;
vCon = location.city.confidence;
@philbar
philbar / main.js
Last active February 8, 2018 16:28
Pre-Fill Select Fields in Unbounce
// version 5.1
;(function(){
window.module = window.module || {};
window.module.lp = window.module.lp || {};
window.module.lp.form = window.module.lp.form || {};
window.module.lp.form.data = null;
window.lp = window.lp || {};
lp.form = lp.form || {};
lp.form.main = lp.form.main || {};
@philbar
philbar / gist:9df7bee394b93e0a6848
Created December 23, 2014 18:10
Auto-Hide Form Error Message in Unbounce
<script>
lp.jQuery(function($) {
// Hide form error message on click
$( ".lp-form-errors" ).click(function() {
$( ".lp-form-errors" ).fadeOut("slow");
});
// Auto-hide form error message after 10 seconds
$( ".lp-pom-button" ).click( function() {
<script>
// Youtube Video Background for Unbounce. V1.0
// lpVideoBG('#SectionID', 'YoutubeVideoID', width, height, muted);
// Use '#lp-pom-root' for a full page video background
lpVideoBG('#lp-pom-block-9', '2XX5zDThC3U', 560, 315, 0);
function lpVideoBG(pageSectionID, youtubeVideoCode, videoWidth, videoHeight, muted) {
<script type="text/javascript">
var getUrlParams = function() {
var params = {}, hash;
var hashes = decodeURI(window.location.href).replace(/\+/g," ").slice(window.location.href.indexOf('?') + 1).split('&');
for (var i=0; i<hashes.length; i++) {
hash = hashes[i].split('=');
params[hash[0]] = hash[1];
}
return params;
};
<!--[if lte IE 8]>
<script>
var oldIEhasFlash = false;
try {
oldIEhasFlash = Boolean(new ActiveXObject('ShockwaveFlash.ShockwaveFlash'));
} catch(exception) {
oldIEhasFlash = ('undefined' != typeof navigator.mimeTypes['application/x-shockwave-flash']);
}
</script>