Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8791259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:49:05+00:00 2026-06-13T22:49:05+00:00

the output for my array look similar to this after print_r($segments): Array ( [kind]

  • 0

the output for my array look similar to this after print_r($segments):

Array
(
    [kind] => analytics#segments
    [username] => account@gmail.com
    [totalResults] => 2334
    [startIndex] => 1
    [itemsPerPage] => 1000
    [items] => Array
    (
        [0] => Array
            (
                [id] => -1
                [kind] => analytics#segment
                [selfLink] => https://www.googleapis.com/analytics/v3/management/segments/gaid::-1
                [segmentId] => gaid::-1
                [name] => All Visits
                [definition] => 
            )
...

        [999] => Array
            (
                [id] => -1
                [kind] => analytics#segment
                [selfLink] => https://www.googleapis.com/analytics/v3/management/segments/gaid::-1
                [segmentId] => gaid::-1
                [name] => All Visits
                [definition] => 
            )
    )
)

This array is an output from google analytics API PHP, the max that it displayed me is 1000 rows as mentioned in the itemsPerPage parameter, but I do have more than 1000, close to 2334 as mentioned in totalResults parameter.

Does some one have any idea how to force it to display all output at once?

When I run this :

 $nextLink = $results->getNextLink()
            ? $results->getNextLink() : 'none';

print($nextLink);

The output is a link:
https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles?start-index=1001&max-results=1000

Accoring to this documentation I have to use the parameter called max-results to display more results per page, but I have no idea how to do so, no much documentation about it.

Any idea how to get the rest of the results using the max-results parameter or the link?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:49:06+00:00Added an answer on June 13, 2026 at 10:49 pm

    Quick Answer:
    https://developers.google.com/analytics/devguides/reporting/core/v3/coreDevguide#working

    Look at the Pagination Information, it seems like your data should have a getNextLink() and getPreviousLink() which may not be part of the data and would not print in a print_r().

    When accessing an API through network, and not knowing how much information the API needs to return, you don’t want to risk sending larges amount of data all at once. This could cause a lot of unnecessary traffic and slow the entire system down.

    One solution, Pagination, is to send back a set number of responses (1000 in this case) and if the user of the API needs more, have them request the next set explicitly.

    Psuedo Code:
    (Sorry I don’t have a working Google-API setup to try this on)

    $finalArray = array();
    
    //Copy $segments into $finalArray;
    while(!empty($segments->getNextLink()))
    {
        //Use $segments->getNextLink()
        //$segments now contains the next set of data
        //Copy $segments into $finalArray;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$jj_post is the array output debug via print_r() . This variable is an array
Print_r function is usually to output the array result, but I want to hide
I'm trying to sort an array that would look something like this: (please ignore
Okay if you would like to know how this numpy array is created look
I have a two dimensional array with the following output Array ( [0] =>
$arr = array(array(array())); foreach($arr as $subarr) { $subarr[] = 1; } var_dump($arr); Output: array(1)
I am using Array() with each_with_index to output a array with index but I
I have something like a json array output, it comes like : { data:
im using the following code to output an array $values = array(); foreach ($album
So I'm trying to output an array to javascript which will tell me if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.