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