This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Analytics.swift | |
// ForeverMaze | |
// | |
// Created by Zane Claes on 2/7/16. | |
// Copyright © 2016 inZania LLC. All rights reserved. | |
// | |
import Foundation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// GameStatic.swift | |
// ForeverMaze | |
// | |
// Created by Zane Claes on 11/20/15. | |
// Copyright © 2015 inZania LLC. All rights reserved. | |
// | |
import SpriteKit | |
import Firebase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Coordinate.swift | |
// ForeverMaze | |
// | |
// Created by Zane Claes on 1/18/16. | |
// Copyright © 2016 inZania LLC. All rights reserved. | |
// | |
import Foundation | |
import SpriteKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
function getCookie(cname) { | |
var name = cname + "="; | |
var ca = document.cookie.split(';'); | |
for(var i=0; i<ca.length; i++) { | |
var c = ca[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// SET UP THESE VARIABLES; | |
$GOOGLE_ANALYTICS_ID = ''; | |
$IOS_STORE_URL = ''; | |
$PATH_TO_GOOGLE_ANALYTICS_FILE = '';// This is where the Google Analytics Helper Script is located | |
function loadGAN($id = null) { | |
global $gan, $PATH_TO_GOOGLE_ANALYTICS_FILE; | |
if($gan) { | |
return $gan; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class GAN { | |
function __construct($id) { | |
$this->id = $id; | |
} | |
protected function gaParseCookie() { | |
if (isset($_COOKIE['_ga'])) { | |
list($version,$domainDepth, $cid1, $cid2) = preg_split('[\.]', $_COOKIE["_ga"],4); | |
$contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1.'.'.$cid2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!isset($_POST['device']) || !isset($_POST['os_version'])) { | |
die('missing params'); | |
} | |
$params = $_POST; | |
$params['ip'] = sha1($_SERVER['REMOTE_ADDR']); | |
// Now we'd query the database for a Referral object match on device, os_version, and ip | |
// We could also restrict our query to recently created Referral objects and/or objects |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!isset($_POST['device']) || !isset($_POST['os_version'])) { | |
die('missing params'); | |
} | |
$params = $_POST; | |
$params['ip'] = $_SERVER['REMOTE_ADDR']; | |
// Now we'd query the database for a Referral object match on device, os_version, and ip | |
// We could also restrict our query to recently created Referral objects and/or objects | |
// which have not been "Claimed." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static NSString * const kKeyHasAttributedReferral = @"hasAttributedReferral"; | |
- (void)attributeReferral { | |
if([[NSUserDefaults standardUserDefaults] boolForKey:kKeyHasAttributedReferral]) { | |
return; | |
} | |
// Attribute referrals | |
NSMutableDictionary *params = [NSMutableDictionary dictionary]; | |
params[@"device"] = [[UIDevice currentDevice].model componentsSeparatedByString:@" "].firstObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Detect's the user's mobile client | |
// If it is a matched client, creates a referral item in parse and returns a redirect URL for the AppStore | |
// | |
function createReferral($params = array()) { | |
require_once '../cms/Mobile_Detect.php'; | |
$detect = new Mobile_Detect; | |
$ios_url = 'https://itunes.apple.com/us/app/aftermath-pvp-guilds-strategy/id702615597?ls=1&mt=8'; | |
$clients = array('iPhone'=>$ios_url, |