• 09-04-2018, 12:28:30
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Merhabalar

    google analytics api php ile veri çekmek ıstıyorumda aslında cekıyorum fakat sadece bu veriyi cekıyoırum dıger verileri nasıl çekerim


  • 09-04-2018, 14:55:20
    #2
    battleship adlı üyeden alıntı: mesajı görüntüle
    Merhabalar

    google analytics api php ile veri çekmek ıstıyorumda aslında cekıyorum fakat sadece bu veriyi cekıyoırum dıger verileri nasıl çekerim


    Daha önce bir mesaja cevap vermiştim oradan bakıp yapabilirsiniz.
    https://www.r10.net/php/975442-googl...post1072981560
  • 05-01-2019, 21:52:02
    #3


    Bunu kullanabilirsiniz fakat
    https://github.com/google/google-api-php-client

    Tek gapi.class.php dosyasıylada halledebilirsiniz.
    https://github.com/erebusnz/gapi-goo...-php-interface


    Dimensions & Metrics Explorer....
    https://developers.google.com/analyt.../core/dimsmets

    Canlı Demo:
    http://ezibilisim.com/demo/1eziinsaa.../ezipanel.html

    Örnekler:

    Belirli bir sayfanın hiti
    <?php
    require __DIR__ . '/vendor/autoload.php';
    $client = new Google_Client();
    $client->setAuthConfig("json dosyanız.json");
    $client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']);
    $analytics = new Google_Service_Analytics($client);
    $viewId = "id yaz";
    $SayfaHit = $analytics->data_ga->get(
        'ga:' . $viewId,
        '7daysAgo',
        'today',
        'ga:sessions',
        array(
            'filters' => 'ga:pagePath==/seo/google-rich-snippets-nedir-nasil-eklenir.html',
            'dimensions' => 'ga:pagePath',
            'metrics' => 'ga:pageviews',
            'sort' => '-ga:pageviews',
            'max-results' => '50'
        )
    );
    foreach($SayfaHit as $s){ ?>
    <?php echo  $s['0']; ?>
    <?php echo  $s['1']; ?>
    <?php } ?>
    İşletim Sistemi
    $operatingSystem = $analytics->data_ga->get(
        'ga:' . $viewId,
        '30daysAgo',
        'today',
        'ga:sessions',
        [
            'dimensions' => 'ga:operatingSystem'
        ]
    );
    Ülke
    $country = $analytics->data_ga->get(
        'ga:' . $viewId,
        '30daysAgo',
        'today',
        'ga:sessions',
        [
            'dimensions' => 'ga:country'
        ]
    );
    Şehir
    $countrycc = $analytics->data_ga->get(
        'ga:' . $viewId,
        '30daysAgo',
        'today',
        'ga:sessions',
        [
            'dimensions' => 'ga:region'
        ]
    );

    Tarayıcı
    $browser = $analytics->data_ga->get(
        'ga:' . $viewId,
        '30daysAgo',
        'today',
        'ga:sessions',
        [
            'dimensions' => 'ga:browser'
        ]
    );

    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script src="https://code.highcharts.com/highcharts.js"></script>
    <div class="col-md-3">
    <div id="browser" style="min-width: 310px; height: 310px; margin: 0 auto"></div>
    </div>
    		 
    <script type="text/javascript">
    Highcharts.chart('browser', {
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
            type: 'pie'
        },
        title: {
            text: 'Tarayıcı',
    		margin:0
        },
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: true,
                    format: '<b>{point.name}</b><br>{point.percentage:.1f} %',
                    distance: -50,
                    filter: {
                        property: 'percentage',
                        operator: '>',
                        value: 5
                    }
                },
                showInLegend: false
            }
        },
        series: [{
            name: 'Tarayıcı',
            colorByPoint: true,
            data: [
    <?php
    foreach($browser as $br){
    	echo "{";
    	echo "name:'" .$br['0']."',";
    	echo "y:" .$br['1'].",";
    	echo "sliced: false,";
    	echo "selected: false";
    	echo "},";
    } 
    ?>
     
    		]
        }]
    });
    </script>