Showing posts with label google analytics. Show all posts
Showing posts with label google analytics. Show all posts

Wednesday, June 5, 2013

Google analytics php api get social search traffic data


$ga = $this->service->data_ga->get(
    5525412,
    "2013-05-05",
    "2013-06-04", 
    "ga:visits,ga:bounces,ga:visitors,ga:newVisits,ga:pageviews,ga:timeOnPage",
    array(
        "filters" => "ga:hasSocialSourceReferral==Yes"
    )
);
And the data will be as follows only with social traffic.

Google_GaData Object
(
    [kind] => analytics#gaData
    [rows] => Array
        (
            [0] => Array
                (
                    [0] => 215
                    [1] => 120
                    [2] => 115
                    [3] => 101
                    [4] => 536
                    [5] => 42342.0
                )

        )

    [containsSampledData] => 
    [totalResults] => 1
    [itemsPerPage] => 1000
    [totalsForAllResults] => Array
        (
            [ga:visits] => 215
            [ga:bounces] => 120
            [ga:visitors] => 115
            [ga:newVisits] => 101
            [ga:pageviews] => 536
            [ga:timeOnPage] => 42342.0
        )

    [nextLink] => 
    [id] => https://www.googleapis.com/analytics/v3/data/ga?ids=ga:XXXXXX&metrics=ga:visits,ga:bounces,ga:visitors,ga:newVisits,ga:pageviews,ga:timeOnPage&filters=ga:hasSocialSourceReferral%3D%3DYes&start-date=2013-05-05&end-date=2013-06-04
    [__queryType:protected] => Google_GaDataQuery
    [__queryDataType:protected] => 
    [query] => Google_GaDataQuery Object
        (
            [max_results] => 
            [sort] => 
            [dimensions] => 
            [start_date] => 
            [start_index] => 
            [segment] => 
            [ids] => ga:XXXXXX
            [metrics] => Array
                (
                    [0] => ga:visits
                    [1] => ga:bounces
                    [2] => ga:visitors
                    [3] => ga:newVisits
                    [4] => ga:pageviews
                    [5] => ga:timeOnPage
                )

            [filters] => ga:hasSocialSourceReferral==Yes
            [end_date] => 
            [start-date] => 2013-05-05
            [end-date] => 2013-06-04
            [start-index] => 1
            [max-results] => 1000
        )

    [previousLink] => 
    [__profileInfoType:protected] => Google_GaDataProfileInfo
    [__profileInfoDataType:protected] => 
    [profileInfo] => Google_GaDataProfileInfo Object
        (
            [webPropertyId] => UA-XXXXXX-1
            [internalWebPropertyId] => XXXXXX
            [tableId] => ga:XXXXXX
            [profileId] => XXXXXX
            [profileName] => XXXXXX.com.au
            [accountId] => XXXXXX
        )

    [__columnHeadersType:protected] => Google_GaDataColumnHeaders
    [__columnHeadersDataType:protected] => array
    [columnHeaders] => Array
        (
            [0] => Google_GaDataColumnHeaders Object
                (
                    [dataType] => INTEGER
                    [columnType] => METRIC
                    [name] => ga:visits
                )

            [1] => Google_GaDataColumnHeaders Object
                (
                    [dataType] => INTEGER
                    [columnType] => METRIC
                    [name] => ga:bounces
                )

            [2] => Google_GaDataColumnHeaders Object
                (
                    [dataType] => INTEGER
                    [columnType] => METRIC
                    [name] => ga:visitors
                )

            [3] => Google_GaDataColumnHeaders Object
                (
                    [dataType] => INTEGER
                    [columnType] => METRIC
                    [name] => ga:newVisits
                )

            [4] => Google_GaDataColumnHeaders Object
                (
                    [dataType] => INTEGER
                    [columnType] => METRIC
                    [name] => ga:pageviews
                )

            [5] => Google_GaDataColumnHeaders Object
                (
                    [dataType] => TIME
                    [columnType] => METRIC
                    [name] => ga:timeOnPage
                )

        )

    [selfLink] => https://www.googleapis.com/analytics/v3/data/ga?ids=ga:XXXXXX&metrics=ga:visits,ga:bounces,ga:visitors,ga:newVisits,ga:pageviews,ga:timeOnPage&filters=ga:hasSocialSourceReferral%3D%3DYes&start-date=2013-05-05&end-date=2013-06-04
)

Sunday, April 7, 2013

Add a new account to google analytics

Add a new account

http://support.google.com/analytics/answer/1009694?hl=en 

To sign up for a Google Analytics account, go to http://www.google.com/analytics and click the Sign up now link. Or, if you are already an AdWords user, you can create a new account via Google Analytics under the Tools and Analysis tab on the AdWords interface.
Creating Additional Analytics Accounts
You can create new Google Analytics accounts even if you are an Administrator for another account.
  1. Sign in to your current Google Analytics account at http://www.google.com/analytics.

  2. Click the Admin tab at the top right of the page.

  3. Above the Profiles tab, at the top of the page, click the All Accounts portion of the link (the full link is: All Accounts > the account to which you're logged in).

  4. Click + New Account.

  5. Select whether you want to track a website or app.

  6. Website: Enter the website name and URL.
    App: Enter the name of the app.

  7. Select an industry category.

  8. Under Data Sharing Settings, select the data-sharing options you want.

  9. Under Reporting Time Zone, select your country or territory from the menu, and select the time zone you want to use.

  10. Enter the name you want to use for the account.

  11. Click Get Tracking ID.