Wednesday, November 1, 2017

Getting to Know Your Users With Analytics

The following is a short extract from our book, Researching UX: Analytics, written by Luke Hay. It's the ultimate guide to using analytics for improved user experience. SitePoint Premium members get access with their membership, or you can buy a copy in stores worldwide.

To understand why your users behave the way they do, you first need to get to know them. You may make assumptions about who those users are, but you should be constantly challenging those assumptions, or at least be backing them up with facts.

There’s a lot of data available in your analytics package that will help build up your knowledge of who’s visiting your website. The more you know about your users, the more informed your design decisions can be.

This data can form a useful starting point for many different types of research. One area where this data is particularly helpful is in recruiting people for usability tests. In usability testing, the better the participant matches the target persona, the better the test.

Usability testing should show how “real” users interact with your website, and where they may be experiencing issues. Knowing who your users are will improve the results of your usability testing, and will give you a better chance of uncovering the issues your “real” users are encountering.

The following section looks at the data in your analytics tool that will help build up your understanding of who your users are.

How Do Users Find Your Website?

Analyzing how users are finding your website can help you understand more about them, and about the context of their visit.

Different analytics tools will classify “traffic sources” or “channels” in different ways. The following are some typical sources for your traffic:

  • Organic search. This typically identifies a user who has clicked an “unpaid” link from the search results.
  • Paid search. Paid search users, sometimes known as “Pay Per Click” or “PPC”, will have arrived on your website via a paid advert on a search engine.
  • Referral. Users from referral links will have followed a link from another website.
  • Social. Social media is often shown as a separate channel from other referral links.
  • Direct. This category includes users who type your domain into the address bar of their browser. It can also include users where the analytics package was unable to identify their traffic source.
  • Email. Links in emails will need to be tagged, since by default, analytics tools are unable to identify users clicking links that don’t appear on web pages.

This analysis can give you a better idea about your users’ intentions. If you’re running a paid search campaign, for example, you’ll be able to see the keywords that were used to find your website (as long as you’ve linked up the Google Analytics and Adwords accounts, and enabled auto-tagging). If users are finding you based on “brand” search terms, you know they’re aware of your company and are searching for you specifically.

Analyzing the behavioral metrics for users, broken down by channel, can help content and marketing teams make decisions about the amount of effort, resources, and budget to dedicate to specific channels. From a UX perspective, it can be useful for identifying problem areas (see Chapter 4), but it also helps to give insight into the mindset of your users. Knowing where your users are coming from can help you to identify whether they’re already familiar with your website, and can start to give you clues about the likely purpose of their visit.

Where Do Your Users Come From?

To begin with, it’s a good idea to start by finding out where—geographically speaking—your users come from. This is a very broad level of analysis that will help you focus your research. Looking at the location of your users will show you the role international visitors play in the success of your website. Geodata will also give you insight into the behavior of users on a national and regional level.

Most analytics tools will give you location data for your users. In Google Analytics, this can be found in Audience > Geo > Location. This report will tell you where your users are coming from, and will also allow you to compare behavior metrics (and different dimensions) for users from different countries, regions or cities.

Location report in Google Analytics

Looking at the percentage of visitors from each country will help you understand the importance of international visitors to your website.

But you need to be careful with your analysis here. Just because no one visits your site from Canada, for example, doesn’t necessarily mean that audience is not important to you. You could be accidentally blocking them! Your marketing efforts may not be reaching where they should, or there may be a whole host of other reasons for the lack of visits. Once again, remember that your website analytics tell you what, but not why.

You may be assuming your website only attracts visitors from your own country, but this report may show that you should also consider the needs of international visitors. This could lead to practical considerations—such as the load speed of your website in other countries, international delivery rates for an ecommerce site, and possible cultural differences between other countries and your own.

Cultural differences based on the country of your visitors can be considerations for both your website’s design and functionality. These differences can be hard to cater for, as cultural differences may be subtle, and often won’t lead to clear ideas for design changes. Still, detailed research on the cultural needs of you users is definitely recommended.

On a more practical level, the way people use ecommerce websites varies dramatically depending on their country. According to data from Worldpay, only 12% of users in Germany make online purchases using cards.

This compares with 63% of UK users and 72% of users in the USA. If you notice that your ecommerce website is getting a lot of visits from Germany, you’ll want to look at offering alternative payment methods. The most popular type of online payment in Germany in real-time bank transfer.

Looking beyond the number of visits, you’ll be able to see behavioral metrics, such as time on site, bounce rate and conversion rate. Focusing on user behavior will enable you to pinpoint particular countries where there may be issues with your website, and thus opportunities to make improvements. If, for example, your ecommerce website is getting a lot of visits from a certain country, or countries, but the conversion rate is low, you may want to reassure those users that you deliver internationally.

There could be many reasons why your conversion rate is low in a particular country. You may not ship to that country, your site may be in the wrong language, the products may be cheaper in that country, or you may not offer the right payment methods (as in the example of Germany). This is where it’s important not to jump to conclusions. Remember, the data only tells you what is happening. It’s important that you set aside research time to find out why.

If you can see an opportunity to increase your conversion rate internationally, you might also want to consider personalizing your website in some way for those countries. This could be as simple as showing the flag of that country and being up front about the exact costs and delivery times for that location. This simple form of personalization will likely resonate with your international users, and will help you unlock potential additional revenue from international sales.

If your analytics shows you’re getting a lot of visits from other countries, you’re likely to be missing out if you don’t factor in cultural differences!

Geo reports can locate users down to state and city level. This means you may also want to assess your visitors by state, region and city to get a clearer picture of who your visitors are and how they behave. The importance of this level of detail will depend on the purpose of your website. For political websites, for example, localized data can be very important to see how a candidate is performing in a key state or region.

What Language Do Your Users Speak?

Knowing what language your users speak can give you additional insight into the content you should serve up. Language and location are sometimes confused when looking at analytics, but the two dimensions have no direct connection. A user can be located in Paris but speak Spanish. Location is ascertained by the IP address of your user, while their language can be derived from the language settings of their browser.

Continue reading %Getting to Know Your Users With Analytics%


by Luke Hay via SitePoint

Beyonseance

Real unique One Pager featuring an interactive Ouija board that "summons the spirit of Beyonce". Thanks so much for the detailed build notes, really helpful for the community inspecting this type of unique site.

Full Review | Direct Link


by Rob Hope @robhope via One Page Love

Calling For Wisdom

Lovely clear typography in this One Pager explaining design methodology Calling For Wisdom. Really feeling this Anton and Lora font pairing.

Full Review | Direct Link


by Rob Hope @robhope via One Page Love

Ann Handley’s Best Practices for Creating Top Notch Content - #infographic

The content of your website is your no.1 sales tool. Photos, embedded tweets and other entertaining elements can be crucial in creating an attractive, visible and efficient site, but the content is what sells. Appealing and user-friendly content permits your readers to discover more about your...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

Data Visualization With DataTables.js and Highcharts.js

Kotlin From Scratch: Exception Handling

Kotlin is a modern programming language that compiles to Java bytecode. It's free and open source, and makes coding for Android even more fun.  

In the previous article, you learned more about object-oriented programming by digging into abstract classes, interfaces, inheritance, and type aliases in Kotlin. 

In this post, you'll continue to learn about programming in Kotlin by learning about exceptions and how to handle them. 

1. Exception Handling

Exceptions are used to indicate a problem in our code during a program's execution. Exception handling is the capability to address (or handle) the exception that might occur. If we don't handle any exception that occurs, our program will stop execution abruptly—crashing our app immediately. 

Exception handling allows our program to continue execution even if there was an exception (though it is highly recommended to log your exceptions and report them using a crash reporting tool like Crashlytics).   

In Java, we have two kinds of exceptions: checked and unchecked. I'll briefly explain both of them, but we'll start with unchecked exceptions. 

Unchecked Exceptions

These are exceptions that are thrown because of flaws in your code. They are a direct or indirect subclass of the RuntimeException superclass. 

Examples of unchecked exceptions include:

  • ArithmeticException: thrown when you divide by zero.
  • ArrayIndexOutOfBoundExceptions: thrown when an array has been accessed with an illegal index. 
  • SecurityException: thrown by the security manager to indicate a security violation.
  • NullPointerException: thrown when invoking a method or property on a null object.

A method that might throw an unchecked exception doesn't contain any information about the exception thrown on its method declaration. 

These types of exception can be prevented by coding right. In the code above, we should have checked if the denominator was zero before performing the operation. For these exceptions, the developer doesn't need to catch the exception using the try...catch block. In other words, we aren't forced by the compiler to wrap the code that might trigger the exception in a try...catch block. Instead, we should just make sure the exceptions never occur in the first place.

Also, remember, Kotlin is a null safe language. In other words, it can help us avoid getting NullPointerExceptions in our code. You can read the Nullability, Loops, and Conditions post to get a refresher on null safety in Kotlin. 

Checked Exceptions in Java

A method that might throw a checked exception needs to declare so in its method signature using the throws keyword. If you call a method that throws a checked exception, you either need to throw it again from your function or to catch it and handle it using a try...catch block. 

Checked exceptions are exceptions that are checked at compile time. These kinds of exceptions inherit from the Exception class. An example of this kind of exception is IOException. This can occur when you try to access a file that can't be opened because it doesn't exist. (FileNotFoundException is a subclass of IOException.)

In the preceding code, we used a try...catch block to handle the IOException inside the editFile() method. We can now call the editFile() method as normal, and the compiler won't complain. 

Looking at the code below, we've refactored the method to instead use the throws keyword in the method signature. This indicates to callers that they need to handle the exception IOException that might be thrown when calling the method editFile().

To call the method above, we need to surround it in a try...catch block to handle the exception.

This has been a brief look at exceptions in Java. Let's now see how Kotlin handles exceptions. 

2. Exceptions in Kotlin

The main difference between Kotlin and Java exception mechanisms is that all exceptions are unchecked in Kotlin. In other words, they are not explicitly declared in the function signatures, as they are in Java.

Here, we have converted the editFile() method to a Kotlin function. You can see that the function doesn't have the throws IOException statement in its function signature. throws isn't even a keyword in Kotlin. 

Also, we can call this function without surrounding it with the try...catch block—and the compiler won't complain. In other words, there's no such thing as checked exceptions in Kotlin. All exceptions are unchecked. (Note that if there is an exception thrown, program execution will stop as normal.) 

If we think this exception might arise, we should still handle it by surrounding the method with a try...catch block—but this is not enforced by the Kotlin compiler. 

If the exception thrown inside the editFile() function is an instance of the IOException class, our catch block will be executed, and we simply print the stack trace for debugging purposes.

The try...catch Block

The try construct with catch and finally clauses in Kotlin is similar to that of Java. 

Here, we are throwing an Exception object inside the try block. Notice we didn't include the new keyword as we do in Java to create a new instance. Also notice that we didn't specify the exception that will be thrown in the function signature as we would have to in Java. 

We handle all subclasses and classes of type Exception in the catch block. The optional finally block is always executed—this is where we typically close any resources or connections that were previously opened so as to prevent resource leaks. For example, if you open a file or create a database or network connection in a try block, you should close or free it in a finally block. 

Note that in Kotlin the throw construct is an expression and can combine with other expressions.

Also, the try construct can be used as an expression.

Here, we assigned the value returned from the try...catch block to the result variable. If the number is not 1, it throws an IllegalArgumentException and the catch block is executed. The false expression in the catch block value will be assigned to the result variable. If the number is 1 instead, then the true expression value will be assigned to the result variable.

Java Interop

Exceptions in Kotlin behave as normal in Java—but I want to make you aware of a useful annotation called @Throws in Kotlin that might come in handy. Because all exceptions in Kotlin are unchecked, developers who consume your Kotlin code from Java might not be aware that your functions throw exceptions. However, you can still add the possible exceptions that might be thrown to a method signature with the @Throw annotation. This will alert Java callers that they need to handle the exception. 

Let's see a practical example of this annotation.

Here, we defined a Kotlin function that can throw an exception IllegalArgumentException only if the type passed to the function is not of type Int

We call this top-level function addNumberToTwo() directly from Java in the following way:

This works fine; the compiler isn't complaining. However, if we want to communicate with Java callers that the addNumberToTwo() top-level function throws an exception, we simply add the @Throws annotation to the function signature. 

This @Throws annotation can accept a comma-separated list of arguments of exception classes. In the code above, we just included one exception class—IllegalArgumentException

Now we have to update our Java code to handle the exception.

If we decompile the Kotlin addNumberToTwo() function, using the Show Kotlin Bytecode feature (if you're in IntelliJ IDEA or Android Studio, use Tools > Kotlin Show Kotlin Bytecode), we'll see the following Java code:

In the generated Java code above (some elements of the generated code were removed for brevity's sake), you can see that the compiler added the throws keyword to the method signature—because we included the @Throws annotation. 

Conclusion

In this tutorial, you learned more about programming in Kotlin by looking into exceptions. We saw that Kotlin doesn't have checked exceptions but that instead, all exceptions are unchecked. We also looked at how to handle exceptions using the try...catch block and saw the usefulness of the @Throws annotation in Kotlin for Java callers. 

To learn more about the Kotlin language, I recommend visiting the Kotlin documentation. Or check out some of our other Android app development posts here on Envato Tuts!

  • Android SDK
    Java vs. Kotlin: Should You Be Using Kotlin for Android Development?
    Jessica Thornsby
  • Android SDK
    Introduction to Android Architecture Components
    Tin Megali
  • Android SDK
    Get Started With RxJava 2 for Android
    Jessica Thornsby
  • Android SDK
    Concurrency in RxJava 2
    Chike Mgbemena


by Chike Mgbemena via Envato Tuts+ Code

#314: The Future of Loading on the Web

Frontend Focus
Issue 314 — November 1, 2017
While native Web Component support isn’t 100% yet, polyfills are available, and this tutorial walks through what’s involved to create your own HTML tags as components.
Ayush Gupta

The idea is to allow Web servers to send back certain headers (e.g. preload link headers) early before the main response.
IETF

A step-by-step tutorial on how to display and annotate PDF files inside your web app using the PSPDFKit JavaScript library. Features include cross-browser support (IE 11 and up), mobile optimized UI, and no server-side component.
PSPDFKit   Sponsor

An interesting creative attempt to create a basic ‘web app’ using nothing but HTML & CSS.
Matt Zeunert

Richard Rutter goes deep on how to improve the readability of your data tables.
Richard Rutter

The takeaway: Google wants you to build PWAs, reduce JS file size, use Web Components, and configure your forms to support autofill.
Dan Fabulich

How popular car selling platform Auto Trader created a high-performance search experience that regularly returns results in less than a second.
Elliot Sumner

Sam Saccone explores recently shipped performance primitives, cutting edge performance techniques, and a glimpse into what the future of loading on the web may hold.
Google Chrome Developers

A helpful overview with some simple things you can do to take positive steps towards a more accessible web. From 2015, but worth revisiting.
Ire Aderinokun

Jobs

In Brief

Microsoft's Plan to Bring Progressive Web Apps (PWAs) to Windows 10 news
Paul Thurrott

W3C Invites Implementations of Preload news
This spec defines the preload keyword that may be used with link elements.
W3C

JS Kongress Munich - The Future of JavaScript on Nov 13-14 news
Join us for two days on the Future of JavaScript (inc. WebAssembly Tooling). Topics include Frontend Architecture, webpack, Angular, React, Perf, etc.
JS Kongress Munich  Sponsor

Unlocking the Benefits of CSS Variables tutorial
The benefits of CSS variables and helpful tips and tricks for working with them.
Jonathan Harrell

How to Build an Interactive Virtual Globe with Three.js tutorial
Jeanne Castillo

3 Commands to Add SSL to 'localhost' for https://localhost on MacOS tutorial
Paul Browne

A Look at the Relatively Uncommon 'output' HTML Element tutorial
Robin Rendle

Using Redux When Building Chrome Extensions tutorial
Bruno Antunes

Emulating CSS Timing Functions with JavaScript tutorial
Ana Tudor

Getting Around a Revoked Certificate in macOS tutorial
Geoff Graham

Using ReactJS, ES6 & JSX to Build a UI (the rise of MERN) tutorial
Part 5 of our Modern Application Stack series - Why ReactJS is driving the development of modern apps.
MONGODB  Sponsor

The Web Began Dying in 2014, Here's How opinion
“GOOG and FB now have direct influence over 70%+ of internet traffic.”
André Staltz

An Animated Flexbox Playground tools
A helpful visual reminder of what effect certain Flexbox properties have.
Blake Bowen

grid-kiss: A PostCSS Plugin to Keep CSS Grids 'Stupidly Simple' tools
Sylvain Pollet-Villard

Koa11y: An Open Source Web Accessibility Tool tools
A desktop app for automatically detecting Web accessibility issues.
Jared Wilcurt

A Better Focus? demo
An attempt at a more ‘visually-pleasing focus for keyboard users’.
CodePen


by via Frontend Focus