1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Tunning my query on Analytics API + PHP

Discussion in 'Google Analytics' started by Roberval Sena, Sep 1, 2015.

  1. #1
    Hi guys!

    Some one could help me to make a search? on Google's API usin PHP?

    The original is working, and give-me back 'sessions' just like google example:


    function getResultsA(&$analytics, $profileId) {
    // Calls the Core Reporting API and queries for the number of sessions
    // for the last seven days.
    return $analytics->data_ga->get(
    'ga:' . $profileId,
    '7daysAgo',
    'today',
    'ga:sessions');
    }





    THE QUESTION: how to get "KEY WORDS" ?
    function getResultsA(&$analytics, $profileId) {
    // Calls the Core Reporting API and queries for the number of sessions
    // for the last seven days.
    return $analytics->data_ga->get(
    'ga:' . $profileId,
    '15daysAgo',
    'today',
    //'ga:sessions');
    'ga:sessions, ga:keyword, -ga:sessions');
    }


    BUT, i just receive this error "Unknown metric(s): ga:keyword"

    I made several combinations with no results
    One example please?


    []s Sena
     
    Roberval Sena, Sep 1, 2015 IP