1 ) { if(!empty($_REQUEST['as_action'])) { $message = $amped_sense->handle_action($_REQUEST['as_action'],$as_page); } } //note about caching $cacheMessage = ""; $activePlugins = get_option( 'active_plugins' ); $cachePluginNames = array('cache', 'rocket', 'wordfence'); foreach($activePlugins as $activePluginPath) { foreach($cachePluginNames as $cachePluginName) { if(stristr($activePluginPath,$cachePluginName)) { if($amped_sense->settings['render'] == 'client') { $cacheMessage = "Looks like you may be using a caching plugin. Please remember to reset your cache after making changes to your ads. Learn more."; } else { $cacheMessage = "Looks like you may be using a caching plugin. Consider switching to client-side render mode for more equally distributed split testing. Learn more."; } break 2; } } } ?>
An "ad recipe" is a set of ads you want to test against another set of ads.
For example, to see if 1 large ad is better than 2 small ads, create one recipe with 1 large ad, and another recipe with 2 small ads. More Info
Congratulations on installing AmpedSense! You're about to run some kick-butt split tests to help you increase your AdSense revenue. Sweet!
$message"; ?> $cacheMessage"; ?> settings['googlerefreshtoken']) || $amped_sense->settings['googlerefreshtoken']=='') { echo "To use the AmpedSense Plugin, you need to sign in to your Google account.
You should use the Google account that you use for AdSense on this site.
This allows AmpedSense to show you which ads are working the best so you can easily make decisions on your split test performance. By authenticating, you agree to our terms.
"; } else { $amped_sense->ensureGoogleAccessToken(); //grab all data from google for each segment date $google_success = false; $apiresults = array(); //indexed by fromdate if(isset($_SESSION['as_googleaccesstoken']) && $_SESSION['as_googleaccesstoken']!="") { foreach($amped_sense->settings['segments'] as $i=>$segment) { //only if not hidden if(!(isset($segment['hide']) && $segment['hide']==1)) { $fromdate = $amped_sense->get_ir_fromdate($i); if(!isset($apiresults[$fromdate])) { $start = date("Y-m-d",strtotime($fromdate)); $end = date("Y-m-d"); $dimension = "CUSTOM_CHANNEL_NAME"; //don't use MATCHED_AD_REQUESTS, because link units count the next page only, and we should factor in unmatched ad requests too //don't use AD_REQUESTS, use PAGE_VIEWS - that's what the adsense portal reports, and it makes most sense $metricclause = "metric=PAGE_VIEWS&metric=CLICKS&metric=PAGE_VIEWS_CTR&metric=PAGE_VIEWS_RPM&metric=EARNINGS"; $returnedjson = $amped_sense->getUrlContents("https://www.googleapis.com/adsense/v1.4/accounts/".urlencode($amped_sense->settings['adsensepublisherid'])."/reports/?access_token=".urlencode($_SESSION['as_googleaccesstoken'])."&userIp=".$amped_sense->ip."&startDate=$start&endDate=$end&useTimezoneReporting=true&dimension=$dimension&$metricclause"); //echo $returnedjson; $apiresult = json_decode($returnedjson,true); if(count($apiresult) && empty($apiresult["error"])) { $google_success = true; $apiresults[$fromdate] = $apiresult; } else { $google_success = false; echo "Error: $returnedjson"; break; } usleep(100000); //.1 second delay for quota mgmt } } } } //foreach segment, list out recipes and how they're doing foreach($amped_sense->settings['segments'] as $i=>$segment) { //only if not hidden if(!(isset($segment['hide']) && $segment['hide']==1)) { $fromdate = $amped_sense->get_ir_fromdate($i); $statsheaderrow = "| Recipe | Date Started | Status | # Ads | Stats $irdate | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
";
echo " ";
echo " ";
echo " ";
if($recipe['active']) echo " ";
else echo " ";
echo " | ";
//name
echo "$recipe[recipename] | "; //date echo "".date("m/d/Y",$recipe['whenstarted'])." | "; //status echo ""; if($recipe['active']) echo "Active"; else echo "Paused"; echo " | "; //ad count echo "".count($recipe['ads'])." | "; //show stats, or link to stats if($google_success) { if(isset($recipe['channelid']) && $recipe['channelid']>0) { //find corresponding report row $reportrow = null; if(isset($apiresults[$fromdate]['rows']) && count($apiresults[$fromdate]['rows'])) { foreach($apiresults[$fromdate]['rows'] as $row) { if($row[0]==$recipe['channelname']) { $reportrow = $row; break; } } } if($reportrow==null) { echo "No data yet (may be delayed up to 1 hour) | "; } else { echo "$reportrow[1] | "; //views echo "$reportrow[2] | "; //clicks echo "".$amped_sense->toPercent($reportrow[3])."% | "; //ctr echo "\$$reportrow[4] | "; //rpm echo "\$$reportrow[5] | "; //earnings } } else { echo "Couldn't find channel - please add New Custom Channel named \"$recipe[channelname]\". Click when done | ";
}
}
else
{
echo "Google Error. Try again, view stats manually or reauthenticate | "; } } } else { echo "||||||||||||
| No ad recipes yet. | ||||||||||||||||||||||||
| Create new recipe | ||||||||||||||||||||||||
Need help? Creating your first split test
'; } //modal for segment selection on clones // this is taken outside of 'ampedsense' div, so must re-add class for bootstrap to take effect ?>