Use the actionscript3 client library to access all Google analysis data in the Flash/Air project

Source: Internet
Author: User

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

  1. // Main class
  2. Import com. denivip. Ga. apiloader;
  3. // Google Analytics account
  4. Import com. denivip. Ga. gaaccount;
  5. // Dimensions
  6. Import com. denivip. Ga. dimensions. campaignmediumdimension;
  7. Import com. denivip. Ga. dimensions. campaignsourcedimension;
  8. // Metrics
  9. Import com. denivip. Ga. Metrics. visitorbouncesmetric;
  10. Import com. denivip. Ga. Metrics. visitorvisitsmetric;
  11. // Filters classes
  12. Import com. denivip. Ga. Filter. filter;
  13. Import com. denivip. Ga. Filter. filteritem;
  14. Import com. denivip. Ga. Filter. filteroperator;
  15. // View classes
  16. Import com. denivip. Ga. View. gaview;

Copy code

4. Configure the Google Analytics API request and initiate a connection through the apiloader class

  1. // Create ga API Connector
  2. VaR apiloader_ga: apiloader = new apiloader ();
  3. // Initial configuration-IDs = GA: 12345
  4. Apiloader_ga.settableid ("Ga: 12345 ");
  5. // Configure dimensions-check developers guide dimensions section for details
  6. Apiloader_ga.setdimensions (new array (New campaignsourcedimension (), new campaignmediumdimension ()));
  7. // Configure metrics-check developers guide metrics section for details
  8. Apiloader_ga.setmetrics (new array (New visitorvisitsmetric (), new visitorbouncesmetric ()));
  9. // Configure filter-check developers guide filters section for details
  10. Apiloader_ga.setfilter (New Filter (New filteritem (New campaignmediumdimension (), new filteroperator ("="), "referral ")));
  11. // Configure segment
  12. VaR SGM: Filter = new filter (New filteritem ("GAID: 10 "));
  13. SGM. addfilteritem ("or", new filteritem ("dynamic: GA: Medium", new filteroperator ("="), "referral "));
  14. Apiloader_ga.segmentdata (SGM );

  15. // Timeframe setup, pay attention that months are zero based in as3
  16. VaR start_date: Date = new date (2010, 10, 9 );
  17. VaR end_date: Date = new date (2010, 11, 8 );
  18. Apiloader_ga.setperiod (start_date, end_date );

  19. // Set callback (returns array of datafeedresponse objects)
  20. Apiloader_ga.setcallback (refreshgraph );

  21. // Configure view (process data and prepares everything in your way)
  22. Apiloader_ga.registerview (GAV );

  23. // Connect and begin Data Loading
  24. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.