Created
April 19, 2014 14:29
-
-
Save gcchaan/11086046 to your computer and use it in GitHub Desktop.
measure of effect for website
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>SEO効果測定</title> | |
<script src="../jquery-2.0.3.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
function getRound(num,m){ | |
num *= Math.pow(10,m); | |
num = Math.round(num); | |
return (num / Math.pow(10,m)).toFixed(m); | |
} | |
$('#MoE [name="submit"]').click(function(){ | |
var cost = $('#cost').val(); | |
var pv = $('#pv').val(); | |
var cpp = $('#cpp').val(); | |
var ctr = $('#ctr').val(); | |
var ct = $('#ct').val(); | |
var cpc = $('#cpc').val(); | |
var cvr = $('#cvr').val(); | |
var cv = $('#cv').val(); | |
var cpa = $('#cpa').val(); | |
if (!cost){ | |
cost = (pv>0 && cpp>0) ? getRound(pv * cpp,1) : getRound(ct * cpc,1); | |
} | |
cpp = getRound(cost / pv,2); | |
ctr>0 ? ct = getRound(pv * ctr,1) : ctr = getRound(ct / pv,1); | |
cpc = getRound(cost / ct,1); | |
cvr ? cv = getRound(ct * cvr,1) : cvr = getRound(cv / ct,1); | |
cpa = getRound(cost / cv,1); | |
$('#cost').val(cost); | |
$('#cpp').val(cpp); | |
$('#ctr').val(ctr); | |
$('#ct').val(ct); | |
$('#cpc').val(cpc); | |
$('#cvr').val(cvr); | |
$('#cv').val(cv); | |
$('#cpa').val(cpa); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<form id="MoE"> | |
<label for="cost">広告費</label><input type="text" name="cost" id="cost"> | |
<br> | |
<label for="pv">PV</label><input type="text" name="pv" id="pv"> | |
<br> | |
<label for="cpp">PV単価</label><input type="text" name="cpp" id="cpp"> | |
<br> | |
<label for="ctr">CTR</label><input type="text" name="ctr" id="ctr"> | |
<br> | |
<label for="ct">CT</label><input type="text" name="ct" id="ct"> | |
<br> | |
<label for="cpc">CPC</label><input type="text" name="cpc" id="cpc"> | |
<br> | |
<label for="cvr">CVR</label><input type="text" name="cvr" id="cvr"> | |
<br> | |
<label for="cv">CV</label><input type="text" name="cv" id="cv"> | |
<br> | |
<label for="cpa">CPA</label><input type="text" name="cpa" id="cpa"> | |
<input type="button" name="submit" value="submit!"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment