Esempio n. 1
0
            }
        });

    });


    gapi.analytics.ready(function() {
        /**
         * Authorize the user with an access token obtained server side.
         */
        var access_token = '<?php 
echo WPAdm_GA_Options::getGAAccessToken();
?>
';
        var id = '<?php 
echo WPAdm_GA_Options::getGAId();
?>
';

        var start_date = '<?php 
echo date("Y-m-d", strtotime("-30 day"));
?>
';
        var end_date = '<?php 
echo date("Y-m-d", strtotime("-1 day"));
?>
';

        gapi.analytics.auth.authorize({
            'serverAuth': {
                'access_token': access_token
Esempio n. 2
0
 protected static function getErrorTemplate()
 {
     if (!get_option('wpadm_ga_pub_key')) {
         return WPAdm_GA_View::$content_file = WPADM_GA__PLUGIN_DIR . 'view' . DIRECTORY_SEPARATOR . 'error_admin_empty_pub_key.php';
     }
     $token = WPAdm_GA_Options::getGAAccessToken();
     if (empty($token)) {
         WPAdm_GA_View::$subtitle = 'Account Connection';
         return WPAdm_GA_View::$content_file = WPADM_GA__PLUGIN_DIR . 'view' . DIRECTORY_SEPARATOR . 'error_admin_empty_ga_token.php';
     }
     $site = WPAdm_GA_Options::getGAUrl();
     if (empty($site) && $_GET['page'] != 'wpadm-ga-menu-settings') {
         return WPAdm_GA_View::$content_file = WPADM_GA__PLUGIN_DIR . 'view' . DIRECTORY_SEPARATOR . 'error_admin_empty_ga_site.php';
     }
     if (isset($_GET['google_oauth2_error'])) {
         return WPAdm_GA_View::$content_file = WPADM_GA__PLUGIN_DIR . 'view' . DIRECTORY_SEPARATOR . 'error_admin_google_error.php';
     }
     if (isset($_GET['error'])) {
         return WPAdm_GA_View::$content_file = WPADM_GA__PLUGIN_DIR . 'view' . DIRECTORY_SEPARATOR . 'error_admin_wpadm_error.php';
     }
     return null;
 }
Esempio n. 3
0
<!--<form method="post">-->
<!--    <input type="hidden" name="form_name" value="ga-account-logout">-->
<!--    <input type="submit" value="logout">-->
<!--</form>    -->
    


<script>

var ga_accounts = {};

gapi.analytics.ready(function () {

    var ACCESS_TOKEN = '<?php 
echo WPAdm_GA_Options::getGAAccessToken();
?>
';
    gapi.analytics.auth.authorize({
        'serverAuth': {
            'access_token': ACCESS_TOKEN
        }
    });

//        var request = gapi.client.analytics.management.webproperties.list({
//            'accountId': '~all'
//        });

    window['ga_request'] = gapi.client.analytics.management.profiles.list({
        'accountId': '~all',
        'webPropertyId': '~all'
Esempio n. 4
0
 protected static function getInstance()
 {
     $instance = new WPAdm_GA_Options();
     self::$instance = $instance;
     $instance->__construct();
 }
Esempio n. 5
0
<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', '<?php 
echo WPAdm_GA_Options::getGAWebPropertyId();
?>
', 'auto');
    ga('send', 'pageview');

</script>