taking pageviews and using the number elsewhere

Looking for information on how to take a reported number from:

Pageviews and using that variable to generate revenue at lets say.. .01 cents a pageview.

Is there an api, or get response codes I can read over to help me with taking the pageviews and using it as a variable somewhere else on my wordpress site..

  • Maniu

    Hey @Brandon

    Currently latest stats are stored as transient with following name:
    $this->cache_name = 'gac32_'.$this->profile_id.get_current_blog_id().$is_network_admin.$this->start_date.$this->end_date.$this->post;
    So its bit hard to get it.

    You could request them directly but it is not as easy. I will give you a code that can point you in right direction:

    global $google_analytics_async_dashboard;
    $options = get_blog_optio( BLOG_ID, 'ga2_settings' );
    $google_analytics_async_dashboard->oauth_token = $options['google_login']['token'];
    $google_analytics_async_dashboard->oauth_secret = $options['google_login']['token_secret'];
    $google_analytics_async_dashboard->profile_id = $options['track_settings']['google_analytics_account_id'];
    $google_analytics_async_dashboard->start_date = date('Y-m-d', time() - XXX...);
    $google_analytics_async_dashboard->end_date = date('Y-m-d', $start_date);
    $summary_data = $google_analytics_async_dashboard->request('simple', '', '','ga:visits,ga:pageviews,ga:visitors,ga:pageviewsPerVisit,ga:visitBounceRate,ga:avgTimeOnPage,ga:percentNewVisits');
    var_dump($summary_data);

    Its untested at all but it may get you started... overall it all requires custom coding:slight_smile:

    Thanks,
    Maniu

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.