GithubHelp home page GithubHelp logo

dahabit / codeigniter-google-analytics-class Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chonthu/codeigniter-google-analytics-class

1.0 1.0 0.0 80 KB

Codeigniter 2 class for google analytics api

codeigniter-google-analytics-class's Introduction

#Codeigniter Google Analytics Api Documentation

Requires sessions

Getting started

  1. Download this class

  2. Copy over config file into your codeigniter config folder

  3. Autoload sessions and set session key in main config file

  4. Copy over the library file into your library folder

  5. Navigate to your new ga_api.php config file and change

    $config['profile_id'] // Your default Google analytics profile id (please note you can access this id from looking your Google analytics account under > settings -> profiles -> profile settings)

    $config['email'] = '[email protected]'; // GA Account mail $config['password'] = 'xxxxxxx'; // GA Account password

  6. Once your config is updated, within your controller you can now.

Example Usage

$this->load->library('ga_api');

// Set new profile id if not the default id within your config document
$this->ga = $this->ga_api->login()->init(array('profile_id' => '182918291281'));

// Query Google metrics and dimensions
// Documentation: http://code.google.com/apis/analytics/docs/gdata/dimsmets/dimsmets.html)
$data = $this->ga
	->dimension('adGroup , campaign , adwordsCampaignId , adwordsAdGroupId')
	->metric('impressions')
	->limit(30)
	->get_object();

// Also please note, if you using default values you still need to init()
$data = $this->ga_api->login()
	->dimension('adGroup , campaign , adwordsCampaignId , adwordsAdGroupId')
	->metric('impressions')
	->limit(30)
	->get_object();


// Please note you can also query against your account and find all the profiles associated with it by
// grab all profiles within your account
$data['accounts'] = $this->ga_api->login()->get_accounts();

Additional Metric Filters

filter
and_filter
or_filter
when
sort_by
limit
offset
segment
dsegment
and_dsegment
or_dsegment

Response types

get
get_object
get_array

Clear for cache

clear // cleat init values
clear_login_data // clear username & password
clear_cache	 // clear cache folder

codeigniter-google-analytics-class's People

Contributors

chonthu avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.