This file contains 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
_gaq.push(['_setCustomVar', 1, 'Join month', <%= "'#{cohort_month}'" %>, 1]); | |
_gaq.push(['_setCustomVar', 2, 'Join year', <%= "'#{cohort_year}'" %>, 1]); |
This file contains 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 | |
function getQuarter() { | |
$monthNumber = intval(date("m")); | |
return floor(($monthNumber - 1) / 3) + 1; | |
} | |
function buildWeek() { | |
if (date('l') == "Sunday") { | |
$sundayTime = time(); | |
} | |
else { |
This file contains 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
_gaq.push(['_setCustomVar', 1, 'cohort_data', {{cohortString}}, 1]); |
This file contains 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
SELECT orders.customerid, | |
orders.transactiondate, | |
orders.transactionamount, | |
cohorts.cohortdate | |
FROM orders | |
JOIN (SELECT customerid, | |
Min(transactiondate) AS cohortDate | |
FROM orders | |
GROUP BY customerid) AS cohorts | |
ON orders.customerid = cohorts.customerid; |