Skip to content

IG User Insights

Justin Stolpe edited this page May 21, 2022 · 4 revisions

Get social metrics for an Instagram user.

Code

use Instagram\User\Insights;
use Instagram\Request\Params;

$config = array( // instantiation config params
    'user_id' => '<IG_USER_ID>',
    'access_token' => '<ACCESS_TOKEN>',
);

// instantiate insights for use
$insights = new Insights( $config );

// initial response
$userInsights = $insights->getSelf();

if ( $insights->pagingNextLink ) { // get next page
    $nextPage = $insights->getPage( Params::NEXT );
}

if ( $insights->pagingPreviousLink ) { // get prev page
    $prevPage = $insights->getPage( Params::PREV );
}
Clone this wiki locally