【问题标题】:Real Time Users Do Not Reflect In The Demographics实时用户不会反映在人口统计数据中
【发布时间】:2013-08-06 01:49:19
【问题描述】:

我在 php 中使用服务器端分析代码将 Google Analytics 与我的网站集成。

 use UnitedPrototype\GoogleAnalytics;

    // Initilize GA Tracker
    $tracker = new GoogleAnalytics\Tracker('UA-XXXXXX', 'XXXXX.com');

    // Assemble Visitor information
    // (could also get unserialized from database)
    $visitor = new GoogleAnalytics\Visitor();
    $visitor->setIpAddress($_SERVER['REMOTE_ADDR']);
    $visitor->setUserAgent($_SERVER['HTTP_USER_AGENT']);
    $visitor->setScreenResolution('1024x768');

    // Assemble Session information
    // (could also get unserialized from PHP session)
    $session = new GoogleAnalytics\Session();

    // Assemble Page information
    $page = new GoogleAnalytics\Page($_SERVER['REQUEST_URI']);
    $page->setTitle('My Page');

    // Track page view
    $tracker->trackPageview($page, $session, $visitor);

问题是,昨天它在网站上显示实时用户,但今天网站上显示的总访问量为零。 这个服务器端实现是否有问题。 ?

【问题讨论】:

    标签: google-analytics


    【解决方案1】:

    最近 Google 推出了 API - Google Real Time API,它提供了类似的功能。试试 - https://developers.google.com/analytics/devguides/reporting/realtime/v3/devguide

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-22
      • 2015-05-24
      • 2019-06-11
      • 1970-01-01
      • 2012-10-04
      • 2011-03-16
      • 1970-01-01
      相关资源
      最近更新 更多