Google Analytics blog launched
A new actionscript3 client library, which provides a simple way to access the analysis data of the air application and Flash Player (although a proxy. With this as3 library, developers can easily integrate google analytics into their Flash/air projects.
Denivip Business Development Director Denis bulichenko said.
Embedding Google analysis data into your application is very simple:
1. Download as3 Google Analytics api library SWC
2. Include the SWC library in your project
3. import warehouse receiving package
- // Main class
- Import com. denivip. Ga. apiloader;
- // Google Analytics account
- Import com. denivip. Ga. gaaccount;
- // Dimensions
- Import com. denivip. Ga. dimensions. campaignmediumdimension;
- Import com. denivip. Ga. dimensions. campaignsourcedimension;
- // Metrics
- Import com. denivip. Ga. Metrics. visitorbouncesmetric;
- Import com. denivip. Ga. Metrics. visitorvisitsmetric;
- // Filters classes
- Import com. denivip. Ga. Filter. filter;
- Import com. denivip. Ga. Filter. filteritem;
- Import com. denivip. Ga. Filter. filteroperator;
- // View classes
- Import com. denivip. Ga. View. gaview;
Copy code
4. Configure the Google Analytics API request and initiate a connection through the apiloader class
- // Create ga API Connector
- VaR apiloader_ga: apiloader = new apiloader ();
- // Initial configuration-IDs = GA: 12345
- Apiloader_ga.settableid ("Ga: 12345 ");
- // Configure dimensions-check developers guide dimensions section for details
- Apiloader_ga.setdimensions (new array (New campaignsourcedimension (), new campaignmediumdimension ()));
- // Configure metrics-check developers guide metrics section for details
- Apiloader_ga.setmetrics (new array (New visitorvisitsmetric (), new visitorbouncesmetric ()));
- // Configure filter-check developers guide filters section for details
- Apiloader_ga.setfilter (New Filter (New filteritem (New campaignmediumdimension (), new filteroperator ("="), "referral ")));
- // Configure segment
- VaR SGM: Filter = new filter (New filteritem ("GAID: 10 "));
- SGM. addfilteritem ("or", new filteritem ("dynamic: GA: Medium", new filteroperator ("="), "referral "));
- Apiloader_ga.segmentdata (SGM );
- // Timeframe setup, pay attention that months are zero based in as3
- VaR start_date: Date = new date (2010, 10, 9 );
- VaR end_date: Date = new date (2010, 11, 8 );
- Apiloader_ga.setperiod (start_date, end_date );
- // Set callback (returns array of datafeedresponse objects)
- Apiloader_ga.setcallback (refreshgraph );
- // Configure view (process data and prepares everything in your way)
- Apiloader_ga.registerview (GAV );
- // Connect and begin Data Loading
- Apiloader_ga.connect (New gaaccount ("login@gmail.com", "PWD "));
Copy code
You can use
You can also see Quick Start Guide to obtain this open-source library.
And ga api documentation.