Menu

Loading
http://test.digitalebilag.no/modules/mod_image_show_gk4/cache/3561f6f7822c388a84ddd2316667940egk-is-115.jpglink
  • 1
  • 2
Prev Next

Om os

Om os

The rest of this paragraph is filler...

Read more

Under tittet Om oss

Under tittet Om oss

And now we’re going to shift things...

Read more

Under tittet Om oss nr 2

Under tittet Om oss nr 2

The image above happens to be centered...

Read more

Nyheter

Nyheter

Biggs skjønte åpenbart at vitsen ikke falt...

Read more

Produkter

Produkter

Nesten 300 mennesker ble drept da et...

Read more
A+ A A-
Hjem

Hjem (2)

Hjem

The image above, though 1200px wide, should not overflow the content area. It should remain contained with no visible disruption to the flow of content.

Image Alignment 300x200
Feels good to be right all the time.

And now we’re going to shift things to the right align. Again, there should be plenty of room above, below, and to the left of the image. Just look at him there… Hey guy! Way to rock that right side. I don’t care what the left aligned image says, you look great. Don’t let anyone else tell you differently.

In just a bit here, you should see the text start to wrap below the right aligned image and settle in nicely. There should still be plenty of room and everything should be sitting pretty. Yeah… Just like that. It never felt so good to be right.

Read more...

Overskrift

View the Full Java Example Before users can view reports on the Google Analytics web site, they must first log in with valid a Google Account. In the same way, your Java application must provide user access to Analytics, and it will use the setUserCredentials() method on the AnalyticsService object, which handles all interaction between the Google Data API Java Library and the Analytics Core Reporting API. With the AnalyticsService object, you can authorize your users with three different methods: ClientLogin Auth Sub OAuth The Google Analytics Authorization document describes which authorization method you should use depending on the type of application you are building. This example uses the simplest ClientLogin method. Here, two constants hold the user name and password. // Credentials for ClientLogin Authorization. private static final String CLIENT_USERNAME = "INSERT_LOGIN_EMAIL_HERE"; private static final String CLIENT_PASS = "INSERT_PASSWORD_HERE"; The service object is created next. The parameter to the service object is a string that represents the name of your application. After that, authorization to Analytics is handled with the setUserCredentials method. // Service Object to work with the Google Analytics Core Reporting API. AnalyticsService analyticsService = new AnalyticsService("gaExportAPI_acctSample_v2.0"); // ClientLogin Authorization. analyticsService.setUserCredentials(CLIENT_USERNAME, CLIENT_PASS); For more information on authorization, see the Google Data API guides for the following, each of which contain examples for Java: ClientLogin AuthSub oAuth Back to Top Retrieving Report Data Once the account feed retrieves the valid table IDs for each view (profile), your application uses them to construct a data feed query. The data feed gets view (profile) data through the API. Because the table ID is a unique identifier for each view (profile), it is a required parameter in the query in order to indicate which view (profile) to retrieve data from. In our example, the application supplies the table ID of the view (profile) to access in the TABLE_ID constant. ... private static final String TABLE_ID = "INSERT_TABLEID_HERE"; ... In the main() method, the code ensures the table ID has been set before requesting data from the data feed. ... if (!TABLE_ID.isEmpty()) { getDataFeed(analyticsService); } ... As with the account feed, the first part of requesting data involves constructing a feed request URL. To do this, you can use the DataQuery class of the Java client library, which simplifies constructing data queries to the API. In this example, a new DataQuery object requests the top 10 URLs, titles, and pageviews for the month of April 2009. // Create a query using the DataQuery Object. DataQuery query = new DataQuery(new URL( "https://www.google.com/analytics/feeds/data")); query.setStartDate("2009-04-01"); query.setEndDate("2009-04-30"); query.setDimensions("ga:pageTitle,ga:pagePath"); query.setMetrics("ga:pageviews"); query.setSort("-ga:pageviews"); query.setMaxResults(10); query.setIds(TABLE_ID); The actual data feed request is made using the getFeed() method on the AnalyticsService object. // Make a request to the API, using DataFeed class as the second parameter. DataFeed dataFeed = analyticsService.getFeed(query.getUrl(), DataFeed.class); Note: This is the same method used to request data from the account feed, with one important difference: the second parameter is the DataFeed class. Keep in mind that if you make requests to the data feed using the AccountFeed class as the second parameter, your request will succeed without error. However, it will return the data from an AccountFeed object, rather than a DataFeed object. For this reason, you will not be able to access report data if you use the wrong class. If the request to the API is successful, the data is returned as a DataFeed object. Under the hood, XML is returned by the API. In the example, the program iterates through each feed entry and sends the page title, URL and pageviews for that page to the system output. // Output data to the screen. System.out.println("----------- Data Feed Results ----------"); for (DataEntry entry : dataFeed.getEntries()) { System.out.println( "\nPage Title = " + entry.stringValueOf("ga:pageTitle") + "\nPage Path = " + entry.stringValueOf("ga:pagePath") + "\nPageviews = " + entry.stringValueOf("ga:pageviews")); } To get a sense of all the data returned from the API, read the XML data feed reference. To learn how you can access all the important data feed information, see the Java Data Feed reference example. Back to Top Error Handling The Google Data Java Client Library throws exceptions in the following cases. User Login If a user supplies an incorrect username or password, or a similar error occurs, the AuthenticationException is thrown. If your application uses ClientLogin to authorize, and a program requests a token too frequently, the user is presented with a captcha challenge response. See more information on using ClientLogin through Google Data APIs. Network Issues If there is a network problem with during a request to the Google Analytics API, the IOException error is thrown. Other Issues The ServiceException error is thrown for a variety of other request errors. For example, if an illegal combination of dimensions and metrics is requested, you will see this error. You will also see this error if you have run out of quota. You can get the specific error code returned by using the getCode() on the Service Exception class. The getMessage() method returns a description of the particular error. Back to Top Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License. For details, see our Site Policies. Last updated juli 15, 2014.

Read more...
Subscribe to this RSS feed
Color I Color II Color III