Skip to content

Instantly share code, notes, and snippets.

View underdown's full-sized avatar

Ryan Underdown underdown

  • Classy Closets
  • Phoenix, AZ
View GitHub Profile
@underdown
underdown / gist:4218625
Created December 5, 2012 19:14
ppc phone track
<?php
if($_GET["gclid"]) {
/* We could switch on each of these if wanted */
$source= $_GET["utm_source"];
$term= $_GET["utm_term"];
$medium= $_GET["utm_medium"];
$campaign=$_GET["utm_campaign"];
$phone="1-888-555-1212"
@underdown
underdown / gist:4234250
Created December 7, 2012 16:06
Traffic Map Configuration
<?php
/************************************************************
Configuration Section
*************************************************************/
$username="email@domain.com";
$password="PASSWORD HERE";
$profile="12345678"; // See http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=73f5507df43705db&hl=en -
$usaonly=1; //Set to filter out non-US information.
$hsize=640; //Horizontal Size
/* Whois Current Domain */
javascript:(function(){var domain=document.location.hostname;window.location.replace('http://whois.sc/'+domain);})();
/* Lookup backlinks on ahrefs */
javascript:(function() {var domain=document.location.hostname;
window.location.replace('https://ahrefs.com/site-explorer/overview/domain/'+domain);})();
/* get IMN optimization report */
var j = document.createElement("form");
<script type="text/javascript">
google_ad_client = "ca-publisher-id";
width = document.documentElement.clientWidth;
google_ad_slot = "1234567890";
google_ad_width = 320;
google_ad_height = 50;
if (width > 500) {
google_ad_slot = "3456789012";
google_ad_width = 468;
google_ad_height = 60;
init = function () {
var e, t, n;
typeof document.hidden != "undefined" ? (e = "hidden", n = "visibilitychange", t = "visibilityState") : typeof document.mozHidden != "undefined" ? (e = "mozHidden", n = "mozvisibilitychange", t = "mozVisibilityState") : typeof document.msHidden != "undefined" ? (e = "msHidden", n = "msvisibilitychange", t = "msVisibilityState") : typeof document.webkitHidden != "undefined" && (e = "webkitHidden", n = "webkitvisibilitychange", t = "webkitVisibilityState"), t && $(document).on(n, function (e) {
var n = "Come back! We miss you!";
document[t] === "visible" && typeof window.originalDocumentTitle != "undefined" && (document.title = window.originalDocumentTitle), document[t] === "hidden" && document.title !== n && (window.originalDocumentTitle = document.title, document.title = n)
}),
}
@underdown
underdown / gist:6142584
Created August 2, 2013 19:15
responsive ad code from adsense
<style>
.responsive { width: 320px; height: 50px; }
@media(min-width: 500px) { .responsive { width: 468px; height: 60px; } }
@media(min-width: 800px) { .responsive { width: 728px; height: 90px; } }
</style>
<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- responsive -->
<ins class="adsbygoogle responsive"
style="display:inline-block"
data-ad-client="ca-pub-3658299045266116"
@underdown
underdown / gist:6213359
Last active December 20, 2015 23:29
rss feed reader
<?php
function getFeed($feed_url) {
$content = file_get_contents($feed_url);
$x = new SimpleXmlElement($content);
echo "<ul>";
$counter = 0;
<script type="text/javascript">
(function(w, d, s) {
function go(){
var js, fjs = d.getElementsByTagName(s)[0], load = function(url, id) {
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.src = url; js.id = id;
fjs.parentNode.insertBefore(js, fjs);
};
load('https://apis.google.com/js/plusone.js', 'gplus1js');
// load('https://server.iad.liveperson.net/hc/46830827/?cmd=mTagRepstate&site=46830827&buttonID=12&divID=lpButDivID-1271372870793&bt=1&c=1', 'livechat');
@underdown
underdown / gist:6245230
Created August 15, 2013 21:41
cross domain link tracking - Google Analytics (cribbed from http://moz.com/ugc/google-analytics-cross-domain-tracking-made-easy-14596)
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
// Add onClick _link to all <a> elements on page where href contains example-A.com
$("a[href*='example-A.com']").click(function() {
_gaq.push(['_link', this.href]);
return false;
});
// Add onSubmit _linkByPost to all <form> elements on page where action contains example-A.com
@underdown
underdown / gist:6296854
Created August 21, 2013 16:38
include distinct analytics tags by referrer
$allowed_host = 'd3cream.com';
$host = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
if(substr($host, 0 - strlen($allowed_host)) == $allowed_host) {
include('analytics-d3.php');
} else {
include('analytics.php');
}