Icons As Part Of A Great User Experience

Sponsored ArticleIcons As Part Of A Great User Experience

Icons are an essential part of many user interfaces, visually expressing objects, actions and ideas. When done correctly, they communicate the core idea and intent of a product or action, and they bring a lot of nice benefits to user interfaces, such as saving screen real estate and enhancing aesthetic appeal. Last but not least, most apps and websites have icons. It’s a design pattern that is familiar to users.

Despite these advantages, icons can cause usability problems when designers hide functionality behind icons that are hard to recognize. An icon’s first job is to guide users to where they need to go, and in this article we’ll see what it takes to make that possible. If you want to take a go at creating your own icons, you can download and test Adobe’s Experience Design CC1 for free and get started right away.

Further Reading on SmashingMag: Link

5
Icons can be compact enough to allow for more controls to be displayed in a relatively small space. (Image: Adobe6) (View large version7)
8
Every app needs a beautiful, memorable icon that attracts people in the app stores and stands out on the home screen. (Image: Apple9) (View large version10)

Types Of Icons Link

As mentioned, an icon is a visual representation of an object, action or idea. If that object, action or idea is not immediately clear to users, the icon will be reduced to visual noise, which will hinder users from completing their task.

There are three types of icons: “universal,” “conflicting” and unique icons. Let’s focus on each type and its impact on the user experience.

Universal Icons Link

A few icons enjoy nearly universal recognition among users. The symbols for home, printing, searching and the shopping cart are such icons.

11
Easily recognizable icons (Image: Icons812)

There is only one problem: Universal icons are rare. Beyond the examples cited above, most icons are ambiguous. They can have different meanings depending on the interface.

Icons With Conflicting Meaning Link

Trouble comes when you implement a commonly used pictogram that has contradictory meanings. The heart and the star are excellent examples. Not only does the functionality associated with these icons vary from app to app, but these two icons compete with each other.

13
(Image: UserTesting14) (View large version15)

As a result, these icons are hard to interpret precisely. Even in the context of an individual app, these symbols can be very confusing when the user expects one outcome and gets another. This impedes the user’s understanding of these icons and discourages them from relying on them in future experiences.

Consider other popular icons that have multiple meanings:

16
(Image: UserTesting17) (View large version18)

Unique Icons Link

Icons are especially bad for anything abstract because they generally are not strong visual representations. How do you describe a unique object or action? Apple’s icon for its Game Center app, for example, is a group of colorful circles. What does the Game Center icon mean? How does it relate to gaming?

19
The Game Center icon fails to convey the concept of games.

As another example, when Google decided to simplify its Gmail interface and move everything behind an abstract icon, it apparently20 got a stream of support requests like, “Where is my Google Calendar?”

21
Gmail user interface for the desktop (View large version22)

An icon might make complete sense once you know what it’s supposed to represent, but it can take some time for first-time users to figure things out. Another problem is that first-time users tend to avoid interface elements that they don’t understand. It’s human nature to distrust the unknown.

Practical Recommendations For Designing With Icons Link

Let’s take a look at some simple techniques and strategies for choosing a proper icon for a given context. Obviously, picking an icon often is a long story, and whatever the choice is, testing icons in interfaces with real users is crucial.

Use Labels to Clarify Abstract or Unfamiliar Icons Link

Icons can save space by reducing text, but at the price of recognition. An icon can represent a thousand different words, and that is exactly the problem. It would be a serious misconception to assume that users either would be familiar with your abstract pictograms or would be willing to spend the extra time discovering what each means.

23
The bottom tab bar icons might confuse first-time Android users. (Image: Google24) (View large version25)

Users are often intimidated by unfamiliar interfaces. What they really want is a clear idea of what will happen before they perform an action in an unfamiliar app. That’s why your icons need to set clear expectations for users before they click or tap on them.

A good user experience can be measured in many ways, one of which is how much it frees the user from having to think. Clarity is the most important characteristic of a great interface. To avoid the ambiguity that plague most icons, we can include a text label26 to clarify an icon’s meaning in a particular context, especially for complex actions and abstract functions.

UserTesting conducted27 a series of tests, comparing labelled icons to unlabelled icons. It found that:

  • users were able to correctly predict what would happen when they tapped a labelled icon 88% of the time;
  • that number dropped to 60% for unlabelled icons. For unlabeled icons that were unique to the app, users correctly predicted what would happen when they tapped an icon only 34% of the time.

Even for universal icons, including a label is usually safer.

28
Labelled icons are much more likely to be used. (Image: Google29) (View large version30)

When Icons Alone Are Adequate Link

So, not all users are familiar with conventional icons, which makes an icon-only interface potentially harder for them to use. On the other hand, experienced users might regard an interface with text labels everywhere to be cluttered. How do we make everyone happy? As Michael Zuschlag mentions31, icons alone will suffice when at least two of the following three conditions are met:

  • space is very limited (i.e. too small for text alone);
  • the icons are standardized (e.g. they are universal);
  • the icons represent objects with strong physical analogs or visual attributes (e.g. a red rectangle to set the page’s background as red).

Beware of Tooltips and Popovers for Icons Link

Some designers believe labels defeat the purpose of icons and clutter the interface. To avoid using labels, they use tooltips. However, tooltips are a poor substitute for text labels. The fact that text labels never need graphic tooltips is a pretty good clue that text is better than icons. Another major disadvantage is that tooltips fail to translate well to touchscreens.

Another common technique is to use tutorials or coach marks or popover hints. However, users might simply rush through the tutorial or forget everything they’ve learned when they next launch your app. Like tooltips, tutorials are no substitute for intuitive design; rather, the opposite. As Matthew at CocoaLove32 says, “Your app’s tutorial screen is just a list of ways you’ve failed.”

33
The Swarm app uses popover hint to educate users. (Image: Mobile Patterns34) (View large version35)

Icons and Button Labels Link

Icons accompanied by labels make information easier to find and scan, as long as they’re placed in the right spot. Place icons according to the natural reading order. As argued by UX Movement36, there are two important factors in an icon’s location:

  • In order for icons to serve as a visual scanning aid, users need to see them before they see the accompanying label. Place icons to the left of their labels so that users see them first.
  • Align the icon with the label’s heading, instead of centering it with the heading and body. Seeing the icon first will help users to scan the page more easily.
37
(Image: UX Movement38) (View large version39)

Icons in Data Tables Link

Let’s imagine that you have a table with numbers in rows, and you need icons as supporting elements to indicate whether a value is good, mediocre or bad. What is the proper placement for icons next to numbers — to the right or left? As Don Nickel explains40, icons to the left of a number usually indicate the intent of the data, whereas icons to the right usually indicate the quality of the data. As with icons with button labels, the placement of icons should follow the natural reading order. There are two possibilities for icon placement:

  • Status icons would appear at the end of the line. As seen in the example below, the user will see the subject first, then the value associated with the subject and, finally, the status of the value.

    41
    (Image: Stack Exchange4442)
  • If the icons themselves are the subject, then they would appear at the start of the line, and everything else would follow thereafter.

    43
    (Image: Stack Exchange4442)

Icons For Accordion Menu Link

The accordion menu is a UI pattern that collapses long lists into manageable groups. It is useful for navigation menus and particularly for search filters.

45
(Image: Viget5046) (View large version47)

Beyond the decision of whether to use an accordion menu, designers often wrestle with the specifics of designing one. The most common questions are:

  • What icon should I use? In terms of usability, is an icon really necessary at all?
  • Should the icon go on the left or right of the menu item?

Lance Gutin conducted an experiment48 with different type of icons (chevrons, plus and minus signs, and triangles) and locations (to the left and right). With three icon choices in two locations and a control group with no icon at all, he identified seven total designs to investigate.

49
Heat map summary of click locations per test (Image: Viget5046) (View large version51)

Analyzing the results, he mentioned two important findings:

  • The most convincing data involved icon location. Presented with an icon to the right of the menu item, many users preferred to click the icon rather than the text label. It’s quite possible that some users believed the icon and the label functioned differently; the icon’s small size and distance from the label increased the recorded task times, resulting in slower task times for accordions with icons to the right.
  • In terms of icon choice, the accordion menu with a plus placed on the left measured the fastest, with 90% of participants predicting that the menu would change. However, most of the task times did not differ statistically, and none of them differed practically.

Please notice that the study doesn’t mean that we all should use the icon with a “plus” icon placed on the left in accordion menus. However, if we put the icon on the right side, it’s safer to make sure that this icon is of a big enough size (at least 44×44px), so it’s easy to hit with a finger or a mouse.

Be Careful With Hamburger Icon Link

Three horizontal lines (i.e. the “hamburger” icon) has become a convention for the main menu button, especially on mobile websites:

52
Google’s Material Design website (View large version53)

However, take into account two important factors when deciding whether to use a hamburger icon:

Designing Icons For Maximum Affordance Link

When designing user interface elements, consider the principles of usability (consistency, affordance, etc.). Affordance, an important concept, essentially means that elements such as icons should be intuitive:

  • Keep icons simple and schematic.

    In most cases, icons aren’t the place to be creative. If you design a new icon, minimize visual detail and avoid a highly realistic image by focusing on the basic characteristics of the object. Fewer graphic details66 aid recognition.

    67
    If you have two options for an icon, choose the simpler one. (View large version68)
  • Choose familiar icons.

    A user’s understanding of an icon is based on previous experience. If you decide to include icons in your interface, research first. Familiarize yourself with icons used by your competitors and with icons commonly used on the platforms you’re targeting (i.e. system icons), because those will be most recognizable to your users.
  • Don’t port platform-specific icons.

    As you build your app for Android or iOS, don’t carry over themed UI69 elements from other platforms. Platforms typically provide sets of icons for common functionality, such as sharing, creating a document and deleting. When you migrate your app to another platform, swap out the old platform-specific icons with the target platform’s counterparts.

    70
    Icons for common functionality in Android (top) and iOS (bottom)

Make Icons Good Touch Targets for Mobile Apps Link

People interact with touch-based interfaces using their fingers. UI controls have to be big enough to capture fingertip actions without frustrating users with unintended actions and tiny targets. The image below shows that the width of the average adult finger is about 11 millimeters (mm) wide, while a baby’s is 8 mm; some basketball players have fingers wider than 19 mm!

A diagram showing the finger width of people in different ages and from Baby to Basketball player71
People often blame themselves for having “fat fingers.” But even baby fingers are wider than most touch targets. (Image: Microsoft72) (View large version73)

The recommended target size for touchscreen objects is 7 to 10 mm. Below are Apple and Google’ recommendations for their platforms (see “iOS Human Interface Guidelines74” and Material Design75):

  • Apple recommends a minimum target size of 44 × 44 pixels. Because physical pixel size varies by screen density, Apple’s pixel specifications apply best to the iPhone’s 320 × 480-pixel 3.5-inch display.
  • Google recommends that touch targets be at least 48 × 48 density-independent pixels (DP). A touch target of 48 × 48 DP results in a physical size of about 9 mm, regardless of screen size. In most cases, icons should be separated by 8 DP or more of space to ensure balanced information-density and usability.
76
Touch targets include the area that responds to user input. (Image: Material Design7977)
78
For this touch area, the icon is 24 DP, and the touch target is 48 DP. The values apply to Android apps. (Image: Material Design7977)

But not only is target size important; sufficient space between touch targets matters, too. The main reason to maintain a minimum distance between touch targets is to prevent users from touching the wrong icon and invoking the wrong action. This becomes extremely important when icons such as “Save” and “Cancel” are right next to each other. At least 2 mm of padding80 between targets is extremely important in such cases.

81

Test Your Icons Link

Icons need to be handled with care. Always test them for usability. Watch how a real first-time user interacts with your UI, which will help you to determine whether the icons are clear enough:

  • Test the icons for recognizability.

    Ask people what they think the icons represent. They shouldn’t have to wonder what they do, because they won’t bother trying to find out.
  • Test the icons for memorability.

    Icons that are hard to remember are usually inefficient. Bring back a set of test users and ask whether they remember an icon’s meaning after having been told a couple weeks earlier.

Conclusion Link

Iconography lies at the heart of UI design. It can make or break the usability of an interface. Every icon should serve a purpose. It should help the user do what they need to do without requiring additional effort. When designed correctly, icons guide users intuitively through a workflow, without relying much on copy. Don’t make your users think. Make clarity in the app a priority!

Recommended Reading Link

This article is part of the UX design series sponsored by Adobe. The newly introduced Experience Design app84 is made for a fast and fluid UX design process, as it lets you sketch out ideas, create interactive prototypes, test and share them all in one place.

You can check out more inspiring projects created with Adobe XD on Behance85, and also visit the Adobe XD blog86 to stay updated and informed. Adobe XD is being updated with new features frequently, and since it’s in public Beta, you can download and test it for free87.

(ms, yk, al, il)

Footnotes Link

  1. 1 http://adobe.ly/2dHvV8T
  2. 2 https://www.smashingmagazine.com/2016/07/how-to-create-icons-adobe-xd/
  3. 3 https://www.smashingmagazine.com/2016/05/easy-steps-to-better-logo-design/
  4. 4 https://www.smashingmagazine.com/2009/03/how-to-use-icons-to-support-content-in-web-design/
  5. 5 https://www.smashingmagazine.com/wp-content/uploads/2016/08/icons-preview-opt.png
  6. 6 http://www.adobe.com/products/photoshop.html
  7. 7 https://www.smashingmagazine.com/wp-content/uploads/2016/08/icons-preview-opt.png
  8. 8 https://www.smashingmagazine.com/wp-content/uploads/2016/08/aesthetic-appeal-preview-opt.png
  9. 9 https://apple.com
  10. 10 https://www.smashingmagazine.com/wp-content/uploads/2016/08/aesthetic-appeal-preview-opt.png
  11. 11 https://www.smashingmagazine.com/wp-content/uploads/2016/08/universal-icons-preview-opt.png
  12. 12 https://icons8.com/
  13. 13 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Icons-With-Conflicting-Meaning-large-opt.png
  14. 14 https://www.usertesting.com/blog/
  15. 15 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Icons-With-Conflicting-Meaning-large-opt.png
  16. 16 https://www.smashingmagazine.com/wp-content/uploads/2016/08/icons-with-multiple-meanings-large-opt.png
  17. 17 https://www.usertesting.com/blog/2015/08/04/user-friendly-ui-icons/
  18. 18 https://www.smashingmagazine.com/wp-content/uploads/2016/08/icons-with-multiple-meanings-large-opt.png
  19. 19 https://www.smashingmagazine.com/wp-content/uploads/2016/08/game-center-icon-preview-opt.jpg
  20. 20 https://productforums.google.com/forum/#!topic/calendar/HqiLewsXVmU%5B1-25%5D
  21. 21 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Gmail-user-interface-for-desktop-large-opt.jpg
  22. 22 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Gmail-user-interface-for-desktop-large-opt.jpg
  23. 23 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Bottom-tab-bar-icons-large-opt.png
  24. 24 https://www.android.com/
  25. 25 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Bottom-tab-bar-icons-large-opt.png
  26. 26 https://www.nngroup.com/articles/icon-usability/
  27. 27 https://www.usertesting.com/blog/2015/08/04/user-friendly-ui-icons/
  28. 28 https://www.smashingmagazine.com/wp-content/uploads/2016/08/labeled-icons-large-opt.png
  29. 29 https://www.thinkwithgoogle.com/articles/chapter-6-usability-and-comprehension.html
  30. 30 https://www.smashingmagazine.com/wp-content/uploads/2016/08/labeled-icons-large-opt.png
  31. 31 http://ux.stackexchange.com/questions/1795/when-to-use-icons-vs-icons-with-text-vs-just-text-links
  32. 32 https://twitter.com/mb
  33. 33 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Swarm-app-large-opt.jpg
  34. 34 http://images.mobile-patterns.com/1400178879546-2014-05-15%2014.29.24.png
  35. 35 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Swarm-app-large-opt.jpg
  36. 36 http://uxmovement.com/buttons/where-to-place-icons-next-to-button-labels/
  37. 37 https://www.smashingmagazine.com/wp-content/uploads/2016/08/icons-order-preview-opt.png
  38. 38 http://uxmovement.com/buttons/where-to-place-icons-next-to-button-labels/
  39. 39 https://www.smashingmagazine.com/wp-content/uploads/2016/08/icons-order-preview-opt.png
  40. 40 http://ux.stackexchange.com/questions/42988/placing-icons-next-to-numbers-to-the-right-or-left
  41. 41 https://www.smashingmagazine.com/wp-content/uploads/2016/08/status-icons-preview-opt.png
  42. 42 http://ux.stackexchange.com/questions/42988/placing-icons-next-to-numbers-to-the-right-or-left
  43. 43 https://www.smashingmagazine.com/wp-content/uploads/2016/08/subject-icons-preview-opt.png
  44. 44 http://ux.stackexchange.com/questions/42988/placing-icons-next-to-numbers-to-the-right-or-left
  45. 45 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Accordion-Menu-large.gif
  46. 46 https://www.viget.com/articles/testing-accordion-menu-designs-iconography
  47. 47 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Accordion-Menu-large.gif
  48. 48 https://www.viget.com/articles/testing-accordion-menu-designs-iconography
  49. 49 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Heatmap-summary-large-opt.png
  50. 50 https://www.viget.com/articles/testing-accordion-menu-designs-iconography
  51. 51 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Heatmap-summary-large-opt.png
  52. 52 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Google-Material-Design-site-large-opt.png
  53. 53 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Google-Material-Design-site-large-opt.png
  54. 54 https://www.smashingmagazine.com/2013/09/responsive-navigation-on-complex-websites/
  55. 55 https://www.smashingmagazine.com/wp-content/uploads/2016/08/hamburger-icon-preview-opt.png
  56. 56 http://ux.stackexchange.com/users/13689/edgarator
  57. 57 https://www.smashingmagazine.com/wp-content/uploads/2016/08/hamburger-icon-preview-opt.png
  58. 58 https://www.nngroup.com/articles/magnifying-glass-icon/
  59. 59 http://sitesforprofit.com/mobile-menu-abtest
  60. 60 https://www.smashingmagazine.com/wp-content/uploads/2016/08/menu-large-opt.jpg
  61. 61 http://sitesforprofit.com/mobile-menu-abtest
  62. 62 https://www.smashingmagazine.com/wp-content/uploads/2016/08/menu-large-opt.jpg
  63. 63 https://www.smashingmagazine.com/wp-content/uploads/2016/08/menu-variations-large-opt.jpg
  64. 64 http://sitesforprofit.com/mobile-menu-abtest
  65. 65 https://www.smashingmagazine.com/wp-content/uploads/2016/08/menu-variations-large-opt.jpg
  66. 66 https://www.nngroup.com/articles/magnifying-glass-icon/
  67. 67 https://www.smashingmagazine.com/wp-content/uploads/2016/08/two-options-for-the-same-icon-large-opt.jpg
  68. 68 https://www.smashingmagazine.com/wp-content/uploads/2016/08/two-options-for-the-same-icon-large-opt.jpg
  69. 69 https://developer.android.com/design/patterns/pure-android.html
  70. 70 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Icons-for-common-functionality-preview-opt.jpg
  71. 71 https://www.smashingmagazine.com/wp-content/uploads/2016/10/touch-width.png
  72. 72 https://developer.microsoft.com/en-us/windows/design
  73. 73 https://www.smashingmagazine.com/wp-content/uploads/2016/10/touchtarget-opt.png
  74. 74 https://developer.apple.com/ios/human-interface-guidelines/
  75. 75 https://material.google.com/
  76. 76 https://www.smashingmagazine.com/wp-content/uploads/2016/08/user-input-preview-opt.png
  77. 77 https://material.google.com
  78. 78 https://www.smashingmagazine.com/wp-content/uploads/2016/08/touch-area-preview-opt.png
  79. 79 https://material.google.com
  80. 80 http://www.lukew.com/ff/entry.asp?1085
  81. 81 https://www.smashingmagazine.com/wp-content/uploads/2016/08/target-size-preview-opt.jpg
  82. 82 https://ia.net/know-how/on-icons
  83. 83 http://uxmyths.com/post/715009009/myth-icons-enhance-usability
  84. 84 http://adobe.ly/2dHuTKc
  85. 85 http://adobe.ly/1U9LS0E
  86. 86 http://adobe.ly/1sGB17z
  87. 87 http://adobe.ly/2dHvV8T

↑ Back to topTweet itShare on Facebook

Advertisement

How To Build Honest UIs And Help Users Make Better Decisions

How To Build Honest UIs And Help Users Make Better Decisions

Many apps today, such as Google Now, Spotify and Amazon, make assumptions about user preferences based on personal data. They may even use this information to make decisions on our behalf, without any direct input from us. For example, Facebook tailors your news feed and Amazon recommends products — both hiding “irrelevant” information and only showing what they think you will like.

This type of design pattern, where user choice is removed, has recently been coined “anticipatory design”. Its aim is to leverage data on user behavior to automate the decision-making process in user interfaces. The outcome lowers the excessive number of decisions people currently make, thereby reducing decision fatigue and improving decisions overall.

Despite the good intentions imbued in anticipatory design, though, automating decisions can implicitly raise trust issues — especially at a time when trust has been eroded through the use of dark patterns1 in user interfaces. Therefore, in contrast to the deceitful dark patterns that are meant to trick users, this article will look at how we can give people confidence in the decisions made for them by using “light patterns,” which ensure that user interfaces are honest and transparent, while even nudging users to make better decisions for themselves.

First, Why Decide For Your User? Link

In today’s online world, consumers face more options than ever before. For example, consider shopping in marketplaces such as Amazon and eBay. Even when we know exactly what we want (replacement Apple headphones, for example), the choice can still be overwhelming:

2
The overwhelming number of options for the exact same product on Amazon and eBay (Images: Amazon113 and eBay4) (View large version5)

Another example is all-you-can-eat music services, such as Spotify, which put huge amounts of music at our fingertips, with no extra cost to listen to more. The additional choices quickly add up:


The overwhelming choice of music on Spotify. (Image: Spotify6)>

While more choice is welcome, too much can create a daunting experience for the user, because then actually making a decision becomes difficult. This problem has been highlighted extensively before, most notably by Barry Shwartz’s paradox of choice and Hick’s Law:

Both studies suggest that by reducing the amount of choice in a user interface, we can improve a user’s ability to make decisions, thereby reducing frustration and making the user experience better.

Articles about “decision fatigue” back this up, stating that making high numbers of decisions can cause people to be less effective at making the important decisions in life. That’s why Mark Zuckerberg wears the same style of clothes9 every day:

I really want to clear my life to make it so that I have to make as few decisions as possible about anything except how to best serve this community.

How To Reduce Choice Link

Reducing the number of choices for a user has, therefore, become the focus for many of today’s apps. This has been done in a number of ways, two of which we’ll discuss now.

Make Options More Relevant Link

Many products are personalized to individual preferences, limiting options only to those deemed relevant to the current user. This has been done famously by Amazon, both on its website and through tailored email recommendations based on data collected on customers:

Tailored recommendations by Amazon10
Tailored recommendations by Amazon (Image: Amazon113) (View large version12)

Anticipate Decisions Link

Recommendations such as those above might not be enough to reduce the difficulty of choice, because users are still faced with the many relevant options that have been filtered through. This is where products can go a step further by making decisions on the user’s behalf, totally removing the burden of choice.

For example, apps such as Google Now13 are increasingly carrying out actions for users, without any direct user input:

Google Now anticipatory design examples14
Examples of anticipatory design in Google Now (Image: Google15) (View large version16)

Google Now makes a lot of decisions in the background, from finding out where you’ve parked your car to searching for football scores — and notifying you at the right time without even having to be asked:

Google Now overview17
Google Now: “What you need, before you ask.” (Image: Google525018) (View large version19)

Spotify shows another instance of this type of assumptive approach by creating playlists for users before they even think to. As was stated in the announcement20:

It’s like having your best friend make you a personalised mixtape every single week.

Spotify Discover Weekly21
Spotify Discover Weekly’s personlized playlists (Image: Spotify22) (View large version23)

The task of searching for new music and deciding which tracks to add to a playlist are carried out for you.

This notion of making decisions for users has been called “anticipatory design24” and has become a topic of debate because of the ethics involved in making decisions on behalf of users.

Creating Trust In Anticipatory Design Link

In the process of reducing choices and making decisions for people using the approaches outlined above, one could be accused of being presumptuous about what users want. This can create distrust if the app doesn’t do what the user expects, especially at a time when many apps have been exposed for exhibiting dark patterns25, tricking users into doing things they don’t want to do.

Consequently, the higher the number of decisions an app makes for users, the more transparent it should be in order to maintain trust. This can be done by avoiding certain dark behaviors and instead favoring transparency through “light patterns,” which keep users informed and in control, even when anticipatory design is used. Let’s explore a few light patterns.

Avoid Limiting Information Link

When options are filtered away to show users more of what they might like (through app personalization and recommendation systems), an inherent problem can be created whereby users begin to see more and more of the same type of content:

Amazon browsing history recommendations26
Amazon browsing history recommendations (Image: Amazon27) (View large version28)

This can making discovery of new things tricky. It is evident not only on e-commerce websites such as Amazon, but also on social media websites such as Facebook. As Time magazine states29:

Facebook hopes to show more links to people who click lots of links, more videos to people who watch lots of videos and so forth.

Many users might not be happy with this because they don’t want brands to determine what they see. For instance, Joel Spolsky, CEO of Stack Overflow, accuses Facebook of hiding information30:

Facebook is not showing all posts. It is choosing what to show you. An interesting question is to what extent does the Facebook algorithm tend to reinforce your preconceptions? Because that’s what it has been trained to do.

Give the User Control Link

One way to avoid limiting information is to make it easier for users to improve the assumptions that are made about them, through feedback mechanisms.

This can be done in different ways, from obvious (and, therefore, easier) mechanisms to less obvious ones:

Feedback mechanisms used by Google, Facebook and Amazon31
Feedback mechanisms used by Google, Facebook and Amazon (View large version32)
  • Google Now (top left) prompts users directly underneath its Now cards to check that the information shown is relevant.
  • Facebook (top right) is slightly less obvious, employing a dropdown caret in the top right of each news item. Clicking the caret reveals options to hide news you don’t want to see.
  • Amazon (bottom) makes it even more difficult to tailor recommendations. You need to navigate to “Your Account” → “Your Recommendations” → “Improve Recommendations” to adjust what it shows you.

Of these three examples, Google offers the most transparent feedback mechanisms, giving multiple obvious interactions for users to provide feedback on cards, ensuring that the user is in control:

Google Now: You're in control33
Google Now: “You’re in control.” (Image: Google413734) (View large version35)

As well as swiping cards, you can also access customization settings from the menu icon on each card:

Customizing Google Now36
Customizing Google Now (Image: Google413734)

In the case of Facebook and Amazon, even though users can provide feedback to tailor what they see, the underlying news feed and recommendation algorithms have greater control, as outlined by Joel Spolsky38.

Avoid Disguising Ads as Content Link

Disguising ads as content is a common dark pattern39, and it can happen when actions are carried out without the user’s explicit consent.

As an example, Google Now recently partnered with brands such as Lyft, Airbnb, Uber and Instacart to prompt users with services available from those apps, at the time it thinks you need them. While cards from third-party services can be useful, when the cards are for paid services, it can almost seem like another form of advertising:

Google Now partner services40
Google Now partner services (Image: Google413734) (View large version42)

When similar dark shades of design can be seen in related products, the motivation behind anticipatory decisions becomes more suspect. Google Maps is a good example of this, appearing to disguise ads as pins43 on map search results:

Google Maps disguised ads44
Google Maps disguises ads as pins (Image: The Next Web45) (View large version46)

Make Use of Existing User Input Link

When making assumptions about users, it’s important that they be accurate. A tried and tested way to do this is to make use of previous user input, as seen in web browsers features such as pre-populated forms, or by remembering credit-card details and passwords in anticipation of future use:

Google Chrome autocomplete47
Google Chrome pre-populated forms

This saves users from having to repeat the same tasks. The same principle can be applied when making more complex assumptions that combine multiple streams of data. Campaign Live48 highlights an example of this when it discussed how the taxi service Hailo’s “Now card” combines time, geolocation and previous user input to rebook taxis in Google Now:

Let’s say you come into London and you book a Hailo cab, and you go into a particular area between 7am and 10am. If you’re still there at 5pm, there’s an assumption you may want to leave and that’s when the Google Now card would prompt you to book a cab.

The assumption is likely to be more accurate in this case (and will appear less like a disguised ad) because the offer is based on a previous booking made by the user via the same service, within a reasonable time period:

Hailo card promtps user based on previous actions49
Hailo card prompts user based on related action (Image: Google525018)

Let Users Opt Out Link

Despite being able to customize the recommendations given to them, sometimes people don’t want apps to make decisions for them at all. In this case, opting out must be easy. Even though you can’t delete the Google Now app, you can disable Now cards in the settings:

Disable cards in Google Now51
Google Now lets users disable Now cards. (Image: Google525018)

In contrast, there is no way to turn off Amazon recommendations, unless you log out completely — which makes sense (for Amazon) because 35% of product sales53 are a result of recommendations, according to Venture Beat.

A question remains, therefore, as to whether features that record and make use of user data in these ways should be opt-in by default. There is a big difference between opt-in by choice and presumed consent, as shown in this example of organ donors from Dark Patterns5654:

Dark patterns chart: Opt-in by choice55
The difference between opt-in by choice and presumed consent for organ donors (Image: Dark Patterns5654)

Basically, when opt-in is the default, consent to be an organ donor is nearly 100%, whereas when the decision to opt-in is not presumed, the consent percentage is very low.

Use Dark Patterns To Help People Link

It’s evident that companies use dark patterns to advance their own agendas, and it’s even easier today with the tools that help companies make decisions on behalf of users. However, what if similar methods could be used to help people make better decisions for themselves? Currently, many of us make poor decisions due to human frailties such as lack of self-control or a focus on short-term gains.

Nudge People to the Right Option Link

In their book Nudge: Improving Decisions About Health, Wealth, and Happiness57, Richard Thaler and Cass Sunstein suggest creating an ethical “choice architecture58” that nudges the user towards choosing the best overall option in the long run.

Nudge: Imporving Decisions About Health, Wealth and Happiness59
Nudge: Improving Decisions About Health, Wealth and Happiness (Image: Wikipedia60)

In this vein, the techniques we have seen being used to create dark patterns can also be used to form light patterns that nudge users to make better choices.

Auto-Enrolment Link

For example, as life expectancy has increased, it’s become important for people to save for old age through pension plans such as the US’ 401(k)61. However, as explained by Thaler and Sunstein, even though these plans offer “free money,” many people still don’t choose to enroll. Possibile solutions suggested by Thaler and Sunstein to help people save for old age include:

  • automatically enrolling people (similar to the organ donor example),
  • forcing people to make a simple yes or no decision on whether to enroll.

These approaches are examples of light patterns because they serve to benefit users, pushing people to take action and to make good long-term decisions. Even though the latter approach forces people to decide, it simplifies the decision to an easy binary choice, which encourages people to participate.

Create Good Behavioral Patterns Link

Alan Shapiro suggests62 that anticipatory apps could actually encourage behavioral patterns in users. By being constantly advised where to go and what to buy, people could become conditioned by app notifications and the decisions made on their behalf.

This could make for some scary scenarios, such as when a company is primarily interested in selling you products, because it’s more likely to instill behavior that favors impulse purchases and the use of its services. For instance, Amazon’s new Prime Pantry service is full of shady patterns, starting with its Pantry Boxes, which encourage people to buy more than they intended:

Amazon Pantry: Buy more63
Amazon Pantry Box encourages purchasing habits (Image: redefined mom64) (View large version65)

As put by Matt Crowley66, head of product at Circadia:

Amazon has shifted the conversation away from “do I need this?” to “what else do I need to fill up this box?”

Amazon has even gone as far as filing patents for a system that leverages user data to predict and deliver products before the customer has even placed an order. Amazon calls it anticipatory shipping67:

Amazon anticipatory shipping patent diagram68
Amazon’s anticipatory shipping patent diagram (Image: Tech Crunch69) (View large version70)

Putting these motives aside, what if the same tactics could be used to help people form good behaviors and habits? There are plenty of examples of this today, with the emergence of many self-improvement and habit-forming apps.

For example, stickK71helps you72 kick bad habits by using “the psychological power of loss aversion and accountability to drive behavior change.”

stickK helps you kick bad habits73
stickK helps you kick bad habits. (Image: stickK74) (View large version75)

Duolingo76 reminds you to practice your new language every day, helping you to form a beneficial habit.

Duolingo notifications77
Duolingo helps you form language-learning habits. (Image: Upquire.com78)

From what we see above, the benefits people get from decisions being made on their behalf in anticipatory design are largely determined by the ethics of the company behind the app. How willing is a company to exploit customer data for its own purposes, and how much data are users willing to trade for convenience?

As explained throughout, giving users control and staying transparent are key to maintaining trust. What do you think about dark patterns used in anticipatory design? Do light patterns really exist, and who is in control when design assumptions are made?

(il, yk, al)

Footnotes Link

  1. 1 http://www.darkpatterns.org
  2. 2 https://www.smashingmagazine.com/wp-content/uploads/2016/09/1-A9vSF2GIo4k005KHHKOOqg-opt.png
  3. 3 https://amazon.co.uk
  4. 4 https://ebay.co.uk
  5. 5 https://www.smashingmagazine.com/wp-content/uploads/2016/09/1-A9vSF2GIo4k005KHHKOOqg-opt.png
  6. 6 https://spotify.com
  7. 7 http://www.ft.com/cms/s/9cebd444-cd9c-11de-8162-00144feabdc0,Authorised=false.html?siteedition=uk&_i_location=http%3A%2F%2Fwww.ft.com%2Fcms%2Fs%2F0%2F9cebd444-cd9c-11de-8162-00144feabdc0.html%3Fsiteedition%3Duk&_i_referer=&classification=conditional_standard&iab=barrier-app
  8. 8 https://www.smashingmagazine.com/2012/02/redefining-hicks-law/
  9. 9 http://www.independent.co.uk/news/people/why-mark-zuckerberg-wears-the-same-clothes-to-work-everyday-a6834161.html
  10. 10 https://www.smashingmagazine.com/wp-content/uploads/2016/09/amazon-choice-opt.png
  11. 11 https://amazon.co.uk
  12. 12 https://www.smashingmagazine.com/wp-content/uploads/2016/09/amazon-choice-opt.png
  13. 13 https://www.google.co.uk/landing/now/
  14. 14 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-now-opt.png
  15. 15 https://google.co.uk
  16. 16 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-now-opt.png
  17. 17 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-now-overview-opt.png
  18. 18 https://www.google.co.uk/landing/now/
  19. 19 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-now-overview-opt.png
  20. 20 https://press.spotify.com/uk/2015/07/20/introducing-discover-weekly-your-ultimate-personalised-playlist/
  21. 21 https://www.smashingmagazine.com/wp-content/uploads/2016/09/spotify-discover-weekly-opt.png
  22. 22 http://spotify.com
  23. 23 https://www.smashingmagazine.com/wp-content/uploads/2016/09/spotify-discover-weekly-opt.png
  24. 24 https://www.smashingmagazine.com/2015/09/anticipatory-design/
  25. 25 http://alistapart.com/article/dark-patterns-deception-vs.-honesty-in-ui-design
  26. 26 https://www.smashingmagazine.com/wp-content/uploads/2016/09/amazon-lamps-opt.png
  27. 27 http://amazon.co.uk
  28. 28 https://www.smashingmagazine.com/wp-content/uploads/2016/09/amazon-lamps-opt.png
  29. 29 http://time.com/3950525/facebook-news-feed-algorithm/
  30. 30 http://www.techworld.com/social-media/facebook-makes-me-angry-stack-overflows-ceo-joel-spolsky-on-developers-ethical-choices-3644318/
  31. 31 https://www.smashingmagazine.com/wp-content/uploads/2016/09/feedback-mechanisms-opt.png
  32. 32 https://www.smashingmagazine.com/wp-content/uploads/2016/09/feedback-mechanisms-opt.png
  33. 33 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-control-opt.png
  34. 34 https://www.google.com/search/about/learn-more/now/#cards
  35. 35 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-control-opt.png
  36. 36 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-control-animated.gif
  37. 37 https://www.google.com/search/about/learn-more/now/#cards
  38. 38 http://www.techworld.com/social-media/facebook-makes-me-angry-stack-overflows-ceo-joel-spolsky-on-developers-ethical-choices-3644318/
  39. 39 http://darkpatterns.org/disguised-ads/
  40. 40 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-now-services-opt.png
  41. 41 https://www.google.com/search/about/learn-more/now/#cards
  42. 42 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-now-services-opt.png
  43. 43 http://thenextweb.com/google/2016/05/24/youll-soon-see-promoted-pins-google-maps-searches/#gref
  44. 44 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-disguised-ads-opt.png
  45. 45 http://thenextweb.com/google/2016/05/24/youll-soon-see-promoted-pins-google-maps-searches/#gref
  46. 46 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-disguised-ads-opt.png
  47. 47 https://www.smashingmagazine.com/wp-content/uploads/2016/09/browser-autocomplete-opt.png
  48. 48 http://www.campaignlive.com/article/brands-show-cards-google/1332234#wMhCR4FsQU1PWOG7.99
  49. 49 https://www.smashingmagazine.com/wp-content/uploads/2016/09/hailo-card-opt.png
  50. 50 https://www.google.co.uk/landing/now/
  51. 51 https://www.smashingmagazine.com/wp-content/uploads/2016/09/google-turn-off-opt.png
  52. 52 https://www.google.co.uk/landing/now/
  53. 53 http://venturebeat.com/2006/12/10/aggregate-knowledge-raises-5m-from-kleiner-on-a-roll/
  54. 54 http://darkpatterns.org/
  55. 55 https://www.smashingmagazine.com/wp-content/uploads/2016/09/dark-patterns-opt.jpeg
  56. 56 http://darkpatterns.org/
  57. 57 https://en.wikipedia.org/wiki/Nudge_(book)
  58. 58 https://en.wikipedia.org/wiki/Choice_architecture
  59. 59 https://www.smashingmagazine.com/wp-content/uploads/2016/09/nudge-opt.jpg
  60. 60 https://en.wikipedia.org/wiki/Nudge_(book)
  61. 61 https://en.wikipedia.org/wiki/401(k)
  62. 62 http://www.fastcodesign.com/3045039/the-next-big-thing-in-design-fewer-choices
  63. 63 https://www.smashingmagazine.com/wp-content/uploads/2016/09/amazon-pantry-opt.png
  64. 64 http://redefinedmom.com/how-does-amazon-prime-pantry-work/
  65. 65 https://www.smashingmagazine.com/wp-content/uploads/2016/09/amazon-pantry-opt.png
  66. 66 https://medium.com/@mwcrowley/the-sketchy-ux-decisions-behind-amazons-prime-pantry-f7cf12878c17#.8lhlf42sv
  67. 67 http://www.forbes.com/forbes/welcome/?toURL=http://www.forbes.com/sites/onmarketing/2014/01/28/why-amazons-anticipatory-shipping-is-pure-genius/&refURL=&referrer=#14fea58d2fac
  68. 68 https://www.smashingmagazine.com/wp-content/uploads/2016/09/amazon-anticipatory-shipping-opt.png
  69. 69 https://techcrunch.com/2014/01/18/amazon-pre-ships/
  70. 70 https://www.smashingmagazine.com/wp-content/uploads/2016/09/amazon-anticipatory-shipping-opt.png
  71. 71 http://www.stickk.com/
  72. 72 http://www.stickk.com/tour
  73. 73 https://www.smashingmagazine.com/wp-content/uploads/2016/09/stick-opt.png
  74. 74 https://stickk.com/
  75. 75 https://www.smashingmagazine.com/wp-content/uploads/2016/09/stick-opt.png
  76. 76 https://www.duolingo.com/
  77. 77 https://www.smashingmagazine.com/wp-content/uploads/2016/09/duolingo-opt.png
  78. 78 http://upquire.com/blog/smart-targeting-dumb/

↑ Back to topTweet itShare on Facebook

Advertisement

Driving App Engagement With Personalization Techniques

Driving App Engagement With Personalization Techniques

Once upon a time, in the not-so-distant past, people considered websites to be a prime indication of how users’ attention was brief and unforgiving. Remember the dreaded bounce rate? Remember the numerous times you worried that your content and graphics might not be 100% clear to users? That was nothing. Compared to mobile, engaging users on the web is a piece of cake.

Researchers claim that we humans can no longer brag about being able to concentrate for a full 12 seconds on a coherent thought, thanks to the digitization of our lives. We now lose concentration after about 8 seconds1, which, sadly, is 1 second less than the attention span of a goldfish. This is the attention-deficit state of mobile users that you need to overcome in order to successfully engage with them. Mobile users don’t just have brief attention spans — they also expect immediate satisfaction when interacting with your app, otherwise they might be quick to close or even uninstall it.

So, what should you do when tasked with “improving app engagement”? There are several actions you should take, but one of the most crucial is to get up close and personal with users. If you don’t segment and personalize your users’ journeys, then you should expect lower rates of conversion and retention.

Whether your product is a bookstore, baby supplies store or retail app, your users expect you to know who they are, what they want to get from your app and how they prefer to receive it. This means that only using your users’ first names in messages is not enough.

2
(View large version3)

Here are the three fundamentals you should follow:

  • Show that you understand them.

    To become personal with your app’s users, you have to truly know who they are and what they want. Segment your audiences, understand their activity patterns in your app, and respond appropriately to their interests and preferences. Several tools on the market4 enable you to analyze your users’ in-app behavior, and you can also connect the app to your CRM for deeper segmentation.
  • Communicate with users at the right mobile moment.

    Analyzing your users’ general usage and past behavior is just one step. You also have to track their real-time interaction with the app5 and act upon it. People open your app to perform a particular action. Make sure to interact with them using mobile-engagement features such as surveys, messages and banners in a way that respects the reason they opened your app in the first place and that adds value to what they were planning to do.
  • Provide meaningful content.

    Mobile engagement needs to be done in context. You need to know the point a user has reached in their journey, their demographics, their physical location, and information about their overall app usage. All of these should be taken into account for optimal personalization.

To better explain these three points, here are five examples of using personalization to drive mobile engagement.

Gamified In-App Messages Link

The first step towards personalization is to segment your users. Collecting data on users’ past interactions with your app will enable you to segment them by how active they are (visit frequency, time in app, actual usage, etc.).

Each and every app has its power users — the people who are most active and loyal. According to Capgemini Consulting, a customer who is loyal to a brand delivers a 23% premium6 in share of wallet, revenue and profitability compared to the average customer. Loyal users should receive a totally different type of in-app message than less active or dormant users, who might feel harassed by gamified messages.

At the right time and in the relevant context, power users should receive in-app messages that are gamified and that drive them to perform a certain action.

In the example below, a frequent user of a bookstore app is asked to recommend a book to a friend to gain 15 points to become a “Super Reader.” This is a great example of how gamified messages give users the feeling that they are an integral part of your app’s community. In addition, they will be thrilled to be recognized for their commitment to your app and to know that you appreciate them.

When users feel this way, they are more likely to rate the app or share it with their friends and connections, helping to create a community of readers who use the app.

7
Encourage your users to engage with gamified incentives. (View large version8)

Gamified in-app messages can be as simple as this one or more complex. You might choose to give your power users credits, points, access to special features and offers, and more.

Whatever type of gamified in-app message you choose, make it fun and make it personal.

Video Messages Link

Let’s say you want to drive users to learn more about one of your products and to purchase it. Understanding how the product works and its value is a strong motivator for consumers to purchase it, and even to learn about more products that they might purchase in the future.

If you’ve already used banners or in-app messages (triggered at the right time, of course) to promote this particular product, but your users aren’t converting as much as you’d like, then a video could be a great way to improve your conversion rates. In the example below, an explainer video is triggered when users who have already engaged with items such as baby food and baby clothes in past sessions are now visiting your toys section for the first time. The video drives purchasing intent by explaining how the baby toy would nurture their baby’s development.

9
Use videos to trigger an emotional reaction to your brand among your segmented users. (View large version10)

Combining the right video with the right mobile moment could lead to better engagement results.

Don’t forget, too, that video is increasingly popular among mobile users. According to an IAB study11, video is on the rise, with 35% of respondents viewing content on mobile devices (in the US, it’s almost 50%). Using mobile video messages is a great way to communicate with users to convey a message that requires a more detailed explanation, or to deliver an emotional message that connects retail buyers to your brand.

Reminder Push Notifications Link

It is not uncommon for a user to add items to their shopping cart but then suddenly not continue with the purchasing process. You want the user to complete the action as soon as possible, though. Push notifications are the ideal solution in this type of scenario, because they can be highly personalized and can contain a deep link that takes the user to exactly where they left off. Push notifications without personalization can drive users insane, whereas one small personalized message — triggered at the right mobile moment — can push (pun intended) users in the right direction.

When possible, add new information to push notifications that can help drive conversion decisions. For example, receiving an offer for free shipping after having added products to their shopping cart could persuade a user to take the next step and finalize the order. Just like the gamification example in our first point, push notifications serve to recognize and reward past activity in the app.

12
Push notifications can drive users to complete actions. You can also use in-app messages after a certain amount of time has passed since a user started a transaction and didn’t complete it.

Use Surveys To Ask And Respond To User Feedback Link

You can’t only talk to your users; you need to listen, too. Whereas tracking their “digital body language” can help you understand what users feel about your app, surveys are more about listening to them and taking the conversation to the next level.

An important step when using surveys is to provide each user with different feedback (such as messages, a secondary survey screen, a video, etc.) and not to use identical “thank you” messages, which are sometimes a turn-off.

In the example below, a user who says that they wouldn’t likely return to a hotel is shown another screen that asks them their main reason for not returning. Meanwhile, those who respond very positively are asked whether they would like to write a short review.

13
Respond differently to each piece of feedback. Keep the conversation going. (View large version14)

A combo survey personalizes the responses of users and drives them to complete the proper action in the right mobile moment.

Offer Coupons Based On The User’s Journey And Purchasing History Link

Coupons have a better chance of being redeemed if they are relevant to the customer’s purchasing history. But you also need to consider the right moment to present a coupon. Choose a time when the user is most likely to be interested in what the coupon offers.

Let’s say you have a customer who has looked at a particular pair of shoes several times throughout the day but has yet to purchase them. To drive the user to purchase, you could offer a time-limited coupon of 20% off the item the next time they visit the screen.

Targeting the right users at the right moment is key to increasing your conversion rate.

15
A coupon offer should relate to past behavior and to real-time interaction in the app.

Understanding the individual user’s journey and how they are using the app overall is key to personalizing your mobile app experience. Mobile users have high expectations16 of the mobile experience and brief attention spans, so careful personalization and in-context awareness are crucial for effective communication and engagement with them.

(yk, il, al)

Footnotes Link

  1. 1 http://time.com/3858309/attention-spans-goldfish/
  2. 2 https://www.smashingmagazine.com/wp-content/uploads/2016/08/personalization-large-preview-opt.png
  3. 3 https://www.smashingmagazine.com/wp-content/uploads/2016/08/personalization-large-preview-opt.png
  4. 4 http://www.apptamin.com/blog/app-analytics-tools/
  5. 5 http://www.insert.io/real-time-personalization-2/
  6. 6 https://www.capgemini-consulting.com/reinventing-loyalty-programs
  7. 7 https://www.smashingmagazine.com/wp-content/uploads/2016/08/books_sm-opt.png
  8. 8 https://www.smashingmagazine.com/wp-content/uploads/2016/08/books_sm-opt.png
  9. 9 https://www.smashingmagazine.com/wp-content/uploads/2016/08/video_baby_sm-opt.png
  10. 10 https://www.smashingmagazine.com/wp-content/uploads/2016/08/video_baby_sm-opt.png
  11. 11 http://www.businessofapps.com/video-gone-mobile-consumption-and-marketing-statistics/
  12. 12 https://www.smashingmagazine.com/wp-content/uploads/2016/08/cart-reminder-push-opt.png
  13. 13 https://www.smashingmagazine.com/wp-content/uploads/2016/08/travel_combo_survey-opt.png
  14. 14 https://www.smashingmagazine.com/wp-content/uploads/2016/08/travel_combo_survey-opt.png
  15. 15 https://www.smashingmagazine.com/wp-content/uploads/2016/08/Retail_banner2_coupon-opt.png
  16. 16 http://www.cioinsight.com/it-strategy/mobile-wireless/slideshows/why-mobile-users-expect-a-better-experience.html
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to topTweet itShare on Facebook

Advertisement

Creating Websites With Dropbox-Powered Hosting Tools

Quick TipsCreating Websites With Dropbox-Powered Hosting Tools

Let’s say you want to quickly sketch out your idea of a website, or just quickly whip up a small site for testing purposes. Also, neither should take a lot of time to build nor should they need a full-stack toolkit. So, where and how do you start? Have you tried creating a website with some Dropbox-powered hosting tools? Well, they certainly can provide a fast and easy solution for these occasions. You don’t have to fiddle with servers or bother about deployment, some of them even come with pre-configured templates that you can use or customize to spare you coding time.

In today’s article, we’ve collected nine tools for you that hook up to your Dropbox to streamline the process of creating and hosting static websites. However, before you settle on a Dropbox-powered platform, always balance the pros and cons to make sure it is the right choice for your project — including performance-wise. As for prototyping, the following tools are a great way to make your workflow more efficient so you can spend more time on the details that really matter.

Small Victories Link

One creation tool that is based on Dropbox is Small Victories31. The idea behind it is simple: The tool connects to your Dropbox, creates a special folder there, and whatever you drop into the folder (be it HTML, Markdown or TXT files, images or videos) will automatically be turned into a website. No installation, server, CMS or uploading necessary; every change you make in the Dropbox folder will be pushed to your site instantly. To ease the job, you can draw on nine ready-made themes (among them a homepage, an e-commerce product page and a feed stream) or if you want more control, you can code your own static HTML files instead and use Dropbox essentially as a hosting service.

2
Drop your files into a designated Dropbox folder and Small Victories31 will make a website out of it.

To keep everything as simple as possible, the content will be displayed on your site in the order as it appears in your Dropbox folder. This requires a bit of planning ahead when it comes to choosing file names, and, as it turns out, numbering them is the easiest way to maintain a structure. Alternatively, you can set the order to sort by date or by manually comma-delimiting the file names in the order you want them to appear in the settings.txt file. Despite its simplicity, the tool isn’t inflexible at all, but surprises with quite some customization features. Adding your own styles and scripts to the default CSS and JS files goes without saying, while Google Fonts and Typekit support give you even more freedom.

By default, every site created with Small Victories will be hosted as a subdomain of .smvi.co, but you can also use a custom domain if you prefer. Just enter the domain in the settings.txt file and make sure to register it in your domain’s DNS settings, too. If you want to make your content available only to a selected group of users, to show an idea to a client, for example, or to share slides, you can also set a password protection. Especially when you’re looking for fast results or want to collaborate with your team members, the tool is convenient to work with. A shared Dropbox folder is all it takes.

Here some examples of sites that were built using Small Victories:

Screenshot from the vis:dmcg site4
vis:dmcg5, an inspiration showcase.
Screenshot from the Salon des Refusés site6
Salon des Refusés7, an exhibition of art and photography.
Screenshot from the XXIX Store site8
XXIX Store9, an e-commerce site.
Screenshot from the Wise App’s site10
Wise App11’s product page for an app.

Pancake Link

Also based on the “drop your files into a Dropbox folder” idea, is Pancake1412. Apart from HTML, it supports .md and .txt and creates a page for every text file you save to the respective Dropbox folder. By default, your project will be hosted as a subdomain of .pancakeapps.com (which is SSL-secured, by the way), but you can also use your own domain with a Pancake site. Apart from Dropbox sync, the platform offers a beta version with git push that comes with version control and supports popular generators such as Jekyll, Sphinx, and Wintersmith.

Pancake13
Pancake1412 serves HTML and text files directly from your Dropbox folder.

DropPages Link

DropPages1715 already launched back in 2011 and offers the same approach as the tools above. Three sub-folders in your Dropbox’s project folder house text (which can also be written in Markdown), images and CSS, and, finally, HTML files to render the text. You simply edit the files on your computer, save, and they’ll automatically sync with your live site. If you don’t want to edit live content, create a folder called _drafts and get started with your new content in there. When you’re done, overwrite the live version with it. Content is minified, gzipped and cached. DropPages is free to use.

DropPages16
DropPages1715 syncs between your Dropbox and your website to make editing content as painless as possible.

Site44 Link

Site442018 updates your website as soon as you’ve saved any changes within the folder you’ve created in Dropbox (it constantly monitors it specially for this purpose, too). Sites created with the tool usually live on a .site44.com sub-domain, but using custom domains is possible as well. For fast response times, your content will be cached on Site44’s servers. Advanced features include password protection, custom 404 pages, and support for redirects. A 30-day trial is free, personal plans start at $4.95 per month.

Site4419
Site442018 monitors a Dropbox folder which you use to save your website assets in. As soon as you make changes to this folder, your website will automatically be updated.

Sitebox.io Link

Another static site generator living in a symbiosis with Dropbox is Sitebox.io21. You can code your own layout (Markdown is supported) or use one of three ready-made, responsive themes. The possibility to set a meta description for every page helps make your website search-engine friendly. A nice bonus: The tool won’t push all changes you make to the folder live instantly. Instead, you can preview your changes first, and when everything is as you want it to be, you can publish in one click. Sitebox is free to use with up to five pages with a subdomain at .sitebox.io, a professional license with an unlimited amount of websites and the option to connect your own domain is available for $10 a month.

Sitebox22
An example site created with Sitebox23 and the default Unison theme.

Cloud Cannon Link

Cloud Cannon2624 is a simple CMS that syncs back and forth with Dropbox or, alternatively, GitHub and Bitbucket, to build and deploy your website to a test or custom domain. Focus lies on collaboration between developers and non-developers. While developers have full control over the source code and can use their favorite tools to build static or Jekyll sites, non-developers can update content visually in the inline editor. For improved performance, websites built with Cloud Cannon are optimized and assets served from a CDN.

Here’s a handy feature: You can set up a staging site for testing purposes and easily push to the live site when you’re ready. Restricting public access to your site or to parts of it is also possible. Plans for Cloud Cannon start at $25 for one user and unlimited websites, more expensive agency and enterprise plans are also available. If you just want to give it a try, there’s a 30-day free trial, too.

Cloud Cannon25
Cloud Cannon2624 manages the balancing act between giving developers full freedom and empowering non-developers and clients to edit content themselves.

KISSr Link

No frills, just a Dropbox-powered hosting service — that’s KISSr2927. You save your website to Dropbox, and when you update files, the changes will be copied to KISSr’s servers. One prototype site is free, for $5 per month you get unlimited sites, storage, and bandwidth.

KISSr28
KISSr2927 provides simple Dropbox web hosting without requiring a personal FTP server.

Paperplane Link

Paperplane3230 spares you fiddling around with FTP by connecting to your Dropbox (or GitHub if you prefer). To use it, pick a name, point Paperplane to your files, and that’s it — the service will transform your assets into a website. Custom domains can be used, too. Paperplane weighs in with $9 per month, but you can also test it out for free with three sites max and no custom domains.

Paperplane31
Paperplane3230 wants to make static hosting simple.

Synkee Link

Synkee3533 works differently than the other tools on our list. It connects to your Dropbox but doesn’t replace an FTP server — simple deployment and version control are the magic words here. A typical workflow with Synkee is as follows: You save your website assets to Dropbox, edit them with your favorite text editor, and the changes get synced to your website’s server as your Dropbox syncs. Deployments can be handled via a dashboard either manually, or you set them to apply automatically when you save a file. Built-in version control and the possibility to revert changes on the FTP server also add to a more efficient workflow. Synkee also works with GitHub and Bitbucket and offers a two-week free trial. After the trial has ended, plans start at $5 per month for one user and ten projects, team plans are also available.

Synkee34
Synkee3533 lets you deploy and sync websites that you save in Dropbox to your FTP server.

What are your experiences? Have you used one of these tools before? Or do you know of one we haven’t listed? Let us know in the comment section below.

(il)

Footnotes Link

  1. 1 http://www.smallvictori.es/
  2. 2 http://www.smallvictori.es/
  3. 3 http://www.smallvictori.es/
  4. 4 http://vis.dmcg.co/
  5. 5 http://vis.dmcg.co/
  6. 6 http://www.salondesrefus.es/
  7. 7 http://www.salondesrefus.es/
  8. 8 http://xxix-store.smvi.co/
  9. 9 http://xxix-store.smvi.co/
  10. 10 http://www.wiseapp.com/
  11. 11 http://www.wiseapp.com/
  12. 12 https://www.pancake.io/
  13. 13 https://www.pancake.io/
  14. 14 https://www.pancake.io/
  15. 15 http://droppages.com/
  16. 16 http://droppages.com/
  17. 17 http://droppages.com/
  18. 18 http://www.site44.com/
  19. 19 http://www.site44.com/
  20. 20 http://www.site44.com/
  21. 21 https://www.sitebox.io/
  22. 22 https://www.sitebox.io/
  23. 23 https://www.sitebox.io/
  24. 24 http://cloudcannon.com/
  25. 25 http://cloudcannon.com/
  26. 26 http://cloudcannon.com/
  27. 27 https://www.kissr.com/
  28. 28 https://www.kissr.com/
  29. 29 https://www.kissr.com/
  30. 30 https://www.paperplane.io/
  31. 31 https://www.paperplane.io/
  32. 32 https://www.paperplane.io/
  33. 33 https://www.synkee.com/
  34. 34 https://www.synkee.com/
  35. 35 https://www.synkee.com/
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to topTweet itShare on Facebook

Advertisement

Boosting Your Rates With Psychologically Validated Principles

Boosting Your Rates With Psychologically Validated Principles

It is often easy to overlook the underlying principles that compel people to take action. Instead, we tend to obsess over minute details — things like button color1, pricing2 and headlines. While these things can compel users to take action, it is worth considering the psychological principles that influence users’ behavior.

Unfortunately, few organizations try to understand what influences user action. Research by Eisenberg Holdings3 shows that for every $92 the average company spends attracting customers, a meager $1 is spent converting them. Real conversion optimization is rooted deeply in psychology.

In this article, we will analyze seven psychology studies that date as far back as 1961. Each experiment raises principles that will help you boost conversions on your website. Some of the experiments are so controversial that they will make you cringe, but the lessons are fundamental.

The Authority Principle: Leverage The Influence Of Authority Figures To Get People To Act Link

In perhaps the most famous study about obedience in psychology, Yale University psychologist Stanley Milgram conducted a series of experiments4 to observe how people react when instructed by an authority figure to do something that conflicts with their conscience. The aim of the experiment was to see how far people would go to obey authority, even if the act of obedience involved harming someone else and acting against their conscience.

For the studies, which began in 1961, Milgram selected participants for his experiment by placing an advert in a newspaper. Once people responded to the advert, Milgram paired the participants and cast lots to determine which of each pair would be the learner and which the teacher. Unbeknownst to the participants, the experiment was rigged — all of them would be teachers, while all of Milgram’s associates would be chosen as learners.

The learner (Milgram’s associate) was taken into a room and connected to an electric chair; the teacher (one of the participants) was then taken to a room next door that contained a row of switches, marked with a scale of 15 to 450 volts — with 15 volts being a “slight shock” and 450 volts producing a “fatal shock.” The teacher was able to see the reactions of the learner through a screen.

5
(Image: Gina Perry6)

Once in the other room, the researcher told the teacher (i.e. the participant) to administer an electric shock every time the learner answered a question incorrectly. The learner was then asked a series of questions and mainly gave wrong answers (on purpose). In return, the authority figure — dressed in a gray lab coat — asked the teacher to administer an electric shock for each wrong answer. The result was stunning: 65% of participants administered the electric shock to the maximum 450 volts, even when the learner long stopped showing signs of breathing. In a variation of the experiment, the authority figure was replaced with an ordinary person, and compliance dropped to a stunning 20%.

Milgram’s experiment7 shows that we will go to great lengths to obey orders, especially from those seen to be as legitimate authorities (whether legal or moral).

How to Use The Authority Principle to Boost Conversions Link

The authority principle can be used to boost conversions in your business. For instance, getting authority endorsements will always go a long way to boosting your conversions and profits. You are far better off, of course, avoiding trying to sell products to people who don’t want them, but even scrupulous websites can boost conversions by tapping into the power of authority. Here are some tips:

  • Get an authority figure or respected celebrity in your industry to endorse you.

    A great example8 of the effectiveness of endorsements from authority figures is Dr. Oz. Dr. Oz is renowned in the health field, and products will sell out at stores as soon as he recommends them. The phrase “Dr. Oz Approved” currently has 1.6 million results in Google (shown below), showing how seriously people take his recommendations.

    Dr. Oz Approved9
    (Image: John Stevens)

    On a smaller scale, Plum District noticed that customers who were referred10 to its products by influential online mothers11boosted the company’s sales by double12 that of customers from other channels. Authority endorsement can come in many forms — a post on social media, a testimonial or active involvement with your brand.

  • Get an authoritative publication to endorse you.

    Mainstream publications are also regarded as authorities. In the absence of an endorsement from a person, an endorsement from a reputable publication would go a long way to boosting your credibility. Rent the Runway reported a 200% increase in conversions13 from visitors referred by fashion magazines and blogs compared to visitors from paid search ads.
  • Become an authority yourself.

    Why get Oprah to endorse you when you can be Oprah yourself? Establish yourself as an authority figure and an industry leader by writing for relevant publications, speaking at relevant events and conferences and establishing relationships with other authority figures. Think of the difference between receiving an email from a stranger and receiving an email from a known thought leader. Making a name for yourself is a great way to warm up your sales leads before you even reach out to them. Seven-figure blogger Neil Patel14 (pictured below) established himself as an authority by highlighting major brands he has worked with, his recognition from the United Nations and the President of the United States, and major publications that have featured him.

    Blogger Neil Patel15
    (Image: John Steven)

The Amos Tversky And Daniel Kahneman Experiment: Use Anchoring To Make People Feel They Are Getting A Bargain Link

Whether you are working for a company or selling your own products, you have probably seen prospective customers bounce from your website because they feel that your products are too expensive. Well, an experiment16 (PDF) conducted by psychologists Amos Tversky and Daniel Kahneman in 1974 holds a solution to boost conversions with these customers, too.

During the experiment, the researchers observed how an initial perception influenced the subjects’ behavior. They surveyed people and asked them to estimate the percentage of African nations that are a part of the United Nations. Before people were allowed to answer, though, the researchers had them spin a wheel painted with numbers from 0 to 100. Unbeknownst to the participants, the wheel had been rigged to stop at either 10 or 65. The experimenters found that the people who landed on the higher number on the wheel were more likely to choose a higher percentage than people who had landed on the lower number. Those who were shown 10 on the wheel estimated, on average, that 25% of African nations were a part of the UN, while those who were shown 65 estimated that the percentage was 45%.

The study reveals the effect of anchoring on our actions. If you want to buy a bomber jacket, and all of the jackets you find are around $200, and you later see a similar jacket that costs $150, you would think it’s a bargain, even if the jacket actually costs $50.

Amazon does this effectively, and automatically, for most of its products:

Amazon listing17
A listing of books on Amazon (Image: John Stevens)

How to Use the Anchoring Principle to Boost Conversions Link

You can use this psychological effect to boost your sales. First, put your product in high esteem — if possible, make people feel that your product is so amazing that they would never be able to afford it. When they later find out the price you are asking, even if it is expensive, they will see it as a bargain. It is no longer a matter of “$500 is too much,” but rather, “Wow, this could easily sell for $2,500, and I’m getting it for $500!”

Many major brands leverage the anchoring effect by offering deals that appear to be such a great bargain that users might feel that they’re crazy to offer them. Below is shown AT&T deliberately offering both a 32 GB and a 64 GB iPad at the discount price of $529.

iPad sale from AT&T18
(Image: Brian Osborne19)

The original prices of the 32 GB and 64 GB iPads were $729 and $829, respectively. The latter would be regarded as expensive. At the discounted price of $529, however, it’s a bargain. The user feels, “Wow! I’m getting double the storage for the same price!” They no longer focus on the high cost of the 64 GB model, but rather on the fact that it costs the same as the model with half the storage.

The Little Albert Experiment: Use The Conditioning Principle To Turbocharge Your Conversions Link

The “Little Albert” experiment is pretty extreme compared to the other experiments discussed here, and it probably wouldn’t be allowed today, not only because of the nature of the experiment itself, but also because the subject was just a child at the time. (It was widely reported that the child, known as Little Albert, never recovered from the effects of the experiment.) The experiment, however, does teach some fundamental lessons about how the human brain is wired.

Psychologist John B. Watson conducted the experiment to observe the phenomenon of classical conditioning20. In simple terms21, classical conditioning is “a learning process by which a subject comes to respond in a specific way to a previously neutral stimulus after the subject repeatedly encounters the neutral stimulus together with another stimulus that already elicits the response.”

The study observed a child who Watson referred to as Albert B. and who is popularly known today as “Little Albert.” Little Albert was nine months old at the time, and he loved animals prior to the experiment — particularly, a white rat. However, Watson began to pair the presence of the rat as well as other animals with the loud bang of a hammer hitting metal. Eventually, Little Albert developed a fear of animals, including the white rat he initially loved, due to the associated discomfort that came with the loud bang. Although the two stimuli were completely unrelated, their association was strong enough to elicit a response in Little Albert.

How to Use the Little Albert Principle to Boost Your Conversions Link

  • Associate a positive emotion with your brand and products.

    In Little Albert’s case, the emotion associated with the presence of animals was fear and anxiety. As a result, he came to dislike animals. For Nike, this emotion is a feeling of being able to achieve your goals by using its products. Nike has carefully positioned itself as the brand to help you achieve your goals. From its trademarked “Just do it” slogan to its strategic use of the underdog character who becomes a hero in some of its ads, Nike has associated the positive emotion of achievement with its brand.
  • Make this positive association obvious.

    Constantly repeat the association until an image is created in the mind of your users, and you’ll notice a significant increase in responses to your messages.

In Nike’s “Find Your Greatness22” ad, we see an overweight boy running desperately and not giving up. The implied message is that anyone can do it, which is in line with Nike’s advertising over the decades.

Nike's Find Your Greatness ad campaign23
Nike’s “Find Your Greatness” ad campaign (Image: DailyMail24)

The Jam Study: Giving People Too Many Choices Can Cripple Sales Link

In his book The Paradox of Choice, psychologist Barry Schwartz famously argues that having too many choices isn’t necessarily good for people and might have unintended effects. This holds true for conversion optimization. The effect was well demonstrated through the famous “jam study.”

Psychologists Sheena Iyengar and Mark Lepper published the jam study in 2000. The study observed the behavior of 754 shoppers25 in an upscale grocery store and how they responded to the choices they were presented with. The shoppers were observed on two consecutive Saturdays. A tasting booth was set up in the grocery store with jam selections on display. The first group of people were exposed to a table displaying 24 varieties of gourmet jam, while the second group were exposed to a table displaying 6 varieties of jam.

The study found that, while the table with more varieties of jam attracted more consumer attention (60% of shoppers stopped at the booth) than the table with fewer varieties of jam (40% of shoppers stopped at the booth), the latter outperformed the former in sales by a factor of 10 to 1.

That’s basically a 900% increase in conversion rate. How would you like the same?

The jam study26
The jam study shows that less is more. (Image: Noah Rickun27)

This has a fairly logical explanation. Research shows28 that human attention span is rapidly declining, shrinking from 12 seconds back in 2000 to 8 seconds now. Rather than increasing your conversions, giving people more options will actually harm it by crippling their decision-making ability.

How to Use the Choice Principle to Boost Your Conversions Link

Offering more options sounds like a good thing, until it isn’t. Giving people more options will draw their attention; if you ask them, they will tell you that’s what they want. However, research shows that most people actually respond better to fewer options. Limit the choices you present to users, and you will more likely get them to take the action you desire right away.

Dropbox’s minimalist home page29 is a great example of this. It’s plainly obvious that Dropbox simply wants you to sign up, and its home page focuses on helping you do just that.

Dropbox home page30
Dropbox’s minimalist home page shows that less is more. (Image: John Stevens)

In “The Minimal Homepage31,” Mattan Griffel observes that the fastest-growing companies in the world — especially in their early days, when they needed fast adoption — all had something in common: a minimalist home page. Dropbox, Quora, LinkedIn, Twitter and Pinterest are some notable examples.

The Decoy Principle: Drive Users Toward One Option Link

Another famous conversion optimization experiment is known as the economist pricing experiment. Psychologist Dan Ariely popularized this experiment32 in his book Predictably Irrational. Ariely surveyed 100 of his students at the Massachusetts Institute of Technology and asked them to choose between the following three options:

  • web-only subscription ($59),
  • print-only subscription ($125),
  • print and web subscription ($125).

The results of the experiment were amazing33: 16 of the 100 people surveyed chose the web-only subscription, while 84 people chose the print and web subscription. Nobody chose the print-only subscription.

Description of the image.34

Ariely then removed the print-only subscription, which nobody chose, and gave another group of 100 students the following options:

  • web-only subscription ($59),
  • print and web subscription ($125).

The findings were surprising: 68% chose the web-only option, while 32% chose the print and web option.

The economist pricing experiment.35
The economist pricing experiment (Image: ConversionXL36)

Why is the contrast so sharp? This is the decoy effect in action; the print-only option was introduced to make the print and web option more attractive and to make the web-only option less attractive. Seeing that the print and web option cost the same amount as the print-only option, people felt that there must have been an error and that they were getting a bargain. But this was psychology in action.

The AT&T offer referred to earlier in the section on anchoring is also a form of decoy pricing. The fact that both the 32 and 64 GB iPads were sold at the same price made the 64 GB model an instant bargain. The 32 GB model could be said to be a decoy to boost sales of the 64 GB.

How to Use the Decoy Principle to Boost Your Conversions Link

You can use the decoy principle to boost sales by introducing an appealing offer that costs less and has more features. This way, people will feel that they are getting a bargain and will be compelled to act immediately. When people see that package A has twice the features of package B, yet both cost the same, they will instantly develop a preference for package A.

Here is another example of decoy pricing used by Apple to sell the iPod Touch:

Apple takes advantage of the decoy effect.37
Apple takes advantage of the decoy effect. (Image: AdvancedWebRanking.com38)

By putting the 8 and 32 GB iPod Touch models side by side and pricing them so closely, some users will feel compelled to select the 32 GB model without considering that competing products might be superior and cost less. Instead, they will focus on the fact that they are getting the 32 GB at a much better price. With those three models marked at those price points, and all with apparently similar features, the 32 GB model looks like the bargain!

As you can see, adding one or more purchasing options can boost conversions. However, something more fundamental is going on here. Why will many people easily hand over their money for a product from one brand, yet be reluctant to pay a fraction of that amount for a similar competing product? Let’s find out.

The Richard Thaler Experiment: Use Context To Boost The Perceived Value Of Your Product Link

Context influences value, which explains why people are more likely to bargain in a flea market than in a boutique. Richard Thaler conducted an experiment39 to demonstrate this principle. Subjects were asked how much they were willing to pay for beer. The first group was told that the beer would be purchased from a local grocery store, while the second group was told that the beer would be purchased from a fancy hotel. The study revealed that people offered to pay more for the very same beer when it came from the fancy hotel.

To boost conversions, master the art of conveying exclusivity through context. The grander people consider your brand to be, the more likely they will pay for your product, even if it is worth much less.

For example, you are more likely to pay a premium for a baseball glove like the ones shown below if you see it on a curated e-commerce website than in an online superstore. Canopy’s home page lists one glove for $250, whereas Amazon’s search results display infielder baseball gloves ranging from $9 to $45.

Listings from Canopy40
Listings from Canopy (Image: Canopy41)
Listings from Amazon42
Listings from Amazon (Image: Amazon43)

How to Use the Principle of Context to Boost Your Conversions Link

Create a premium feel to attract premium customers. Some believe that offering discounts or competing on price is not a smart long-term approach to business. Instead, create a premium impression and you will command premium rates.

That being said, it’s not always about what you’re offering. Simple brand positioning and marketing can go a long way to improving your conversions. This brings us to our next point.

The Familiarity Principle: Use Repetition To Get People To Notice Your Offer Link

The power of repetition in boosting conversions is deeply rooted in psychology, and it is one of the principles advocated by Robert Cialdini in his book Influence: The Psychology of Persuasion.

A 2013 study by Jaroslaw Jankowski44 found that content repetition can boost conversions on websites. The more exposed people are to your offer, the more familiar they become with it, and the higher the probability that they will act on it. This is known in marketing as the rule of seven45; that is, prospective customers need to come across your offer at least seven times before they take action.

How to Use the Familiarity Principle to Boost Your Conversions Link

Don’t limit yourself to one marketing channel. Spread your message across multiple channels, maximizing touch points, and you will likely notice a boost in conversions. Jay Baer offers a great case study46. He says that his Jay Today show, a daily three-minute video, is one of his strongest content-marketing performers. After each video is published, he repurposes it into eight different pieces of useful content, which he then distributes on eight different platforms, including YouTube, LinkedIn and Medium. This helps grow his business by attracting more attention and increasing his likability, using the power of repetition.

Below is the YouTube version of one of his recent shows promoted as a linked post on Facebook, followed by the same content in iTunes podcast form.

47
Jay Baer uses the familiarity principle. (Image: Jay Baer48)
49
(Image: Jay Baer50)

His effective distribution of content based on the familiarity principle has been a key driver of growth for Baer’s company.

The familiarity principle also works well in advertising. Research shows that companies will consistently repeat ads51 to the same people because it creates in them a subconscious desire for the products.

Conclusion Link

Effective conversion optimization goes beyond simply changing a button’s color or making a few tweaks here and there. The trick is knowing the fundamental principles that make people act the way they do. Hopefully, the psychology studies reviewed in this article have provided you with some practical insight to boost your conversion rates.

Whether by leveraging the power of classical conditioning (the Little Albert experiment), keying into the effectiveness of decoy pricing (the economist pricing experiment) or using plain-old social proof (Milgram’s experiments), you can do much to boost your website’s conversion rates. The key is in the implementation. Take lessons from the studies referred to above, implement them on your website, and watch your conversions increase.

Further Reading Link

  • Influence: The Psychology of Persuasion, Robert Cialdini
  • Predictably Irrational, Dan Ariely
  • More Isn’t Always Better52,” Barry Schwartz, Harvard Business Review

(ah, yk, al, il)

Footnotes Link

  1. 1 https://www.smashingmagazine.com/2009/10/call-to-action-buttons-examples-and-best-practices/
  2. 2 https://www.smashingmagazine.com/2009/10/call-to-action-buttons-examples-and-best-practices/
  3. 3 https://econsultancy.com/blog/7657-92-1-marketings-dirty-little-statistic-5/
  4. 4 http://www.simplypsychology.org/milgram.html
  5. 5 https://www.smashingmagazine.com/wp-content/uploads/2016/08/milgram-scale-opt.jpg
  6. 6 http://www.gina-perry.com/behind-the-shock/milgrams-obedience-experiments/
  7. 7 https://www.mtholyoke.edu/~apkokot/results.htm
  8. 8 https://blog.kissmetrics.com/being-an-authority/
  9. 9 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Dr-Oz-approved-opt.png
  10. 10 https://techcrunch.com/2011/11/27/social-proof-why-people-like-to-follow-the-crowd/
  11. 11 https://techcrunch.com/2011/11/27/social-proof-why-people-like-to-follow-the-crowd/
  12. 12 https://techcrunch.com/2011/11/27/social-proof-why-people-like-to-follow-the-crowd/
  13. 13 https://techcrunch.com/2011/11/27/social-proof-why-people-like-to-follow-the-crowd/
  14. 14 https://www.quicksprout.com/blog/
  15. 15 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Neil-Patel-opt.png
  16. 16 http://people.hss.caltech.edu/~camerer/Ec101/JudgementUncertainty.pdf
  17. 17 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Amazon-anchoring-opt.png
  18. 18 https://www.smashingmagazine.com/wp-content/uploads/2016/09/iPadSale-opt.png
  19. 19 http://www.geek.com/apple/att-slashes-300-off-ipad-3g-64gb-1330393/
  20. 20 http://www.simplypsychology.org/classical-conditioning.html
  21. 21 http://www.thefreedictionary.com/classical+conditioning
  22. 22 https://www.youtube.com/watch?v=2JnYcuRW_qo
  23. 23 https://www.smashingmagazine.com/wp-content/uploads/2016/09/find-your-greatness.jpg
  24. 24 http://www.dailymail.co.uk/news/article-2185150/Find-Your-Greatness-advert-Story-200lb-jogging-boy-Nathan-Sorrell-new-Nike-ad-charmed-America.html
  25. 25 https://hbr.org/2006/06/more-isnt-always-better
  26. 26 https://www.smashingmagazine.com/wp-content/uploads/2016/09/jam-study-results-opt.jpg
  27. 27 http://noahrickun.com/lets-jam-make-more-sales-by-using-the-paradox-of-choice/
  28. 28 https://hostingfacts.com/internet-facts-stats-2016/
  29. 29 https://www.dropbox.com/
  30. 30 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Dropbox-opt.png
  31. 31 http://www.growhack.com/2013/04/the-minimal-homepage/#.V40u3esrLnA
  32. 32 http://conversionxl.com/pricing-experiments-you-might-not-know-but-can-learn-from/
  33. 33 http://www.digitalcurrent.com/digital-marketing/boost-conversion-optimization/
  34. 34 https://www.smashingmagazine.com/wp-content/uploads/2016/09/decoy-pricing-the-economist-pricing-opt.png
  35. 35 https://www.smashingmagazine.com/wp-content/uploads/2016/09/decoy-pricing-the-economist-pricing2-opt-.jpg
  36. 36 http://conversionxl.com/pricing-experiments-you-might-not-know-but-can-learn-from/
  37. 37 https://www.smashingmagazine.com/wp-content/uploads/2016/09/The-Decoy-Effect-opt.jpg
  38. 38 http://www.advancedwebranking.com/blog/eight-proven-pricing-strategies-guarantee-conversions/
  39. 39 https://econsultancy.com/blog/62591-why-pricing-experiments-prove-our-assumptions-are-wrong/
  40. 40 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Canopy-opt.png
  41. 41 https://canopy.co/
  42. 42 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Amazon-listings-opt.png
  43. 43 http://www.amazon.com/
  44. 44 http://link.springer.com/chapter/10.1007%2F978-3-642-36543-0_45
  45. 45 http://www.effectivebusinessideas.com/the-rule-of-7/
  46. 46 http://contentmarketinginstitute.com/content-inc/blog/repurpose-one-video/
  47. 47 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Convince-and-Convert-opt.png
  48. 48 https://www.facebook.com/ConvinceConvert
  49. 49 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Jay-Baer-opt.png
  50. 50 https://itunes.apple.com/us/podcast/jay-today-podcast/id915527026?mt=2
  51. 51 https://www.sciencedaily.com/releases/2008/12/081209125828.htm
  52. 52 https://hbr.org/2006/06/more-isnt-always-better
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to topTweet itShare on Facebook

Advertisement

Content Security Policy, Your Future Best Friend

Content Security Policy, Your Future Best Friend

A long time ago, my personal website was attacked. I do not know how it happened, but it happened. Fortunately, the damage from the attack was quite minor: A piece of JavaScript was inserted at the bottom of some pages. I updated the FTP and other credentials, cleaned up some files, and that was that.

One point made me mad: At the time, there was no simple solution that could have informed me there was a problem and — more importantly — that could have protected the website’s visitors from this annoying piece of code.

A solution exists now, and it is a technology that succeeds in both roles. Its name is content security policy (CSP).

What Is A CSP? Link

The idea is quite simple: By sending a CSP header from a website, you are telling the browser what it is authorized to execute and what it is authorized to block.

Here is an example with PHP:

<?php header("Content-Security-Policy: <your directives>"); ?>

Some Directives Link

You may define global rules or define rules related to a type of asset:

default-src 'self' ; # self = same port, same domain name, same protocol => OK 

The base argument is default-src: If no directive is defined for a type of asset, then the browser will use this value.

script-src 'self' www.google-analytics.com ; # JS files on these domains => OK 

In this example, we’ve authorized the domain name www.google-analytics.com as a source of JavaScript files to use on our website. We’ve added the keyword 'self'; if we redefined the directive script-src with another rule, it would override default-src rules.

If no scheme or port is specified, then it enforces the same scheme or port from the current page. This prevents mixed content. If the page is https://example.com, then you wouldn’t be able to load http://www.google-analytics.com/file.js because it would be blocked (the scheme wouldn’t match). However, there is an exception to allow a scheme upgrade. If http://example.com tries to load https://www.google-analytics.com/file.js, then the scheme or port would be allowed to change to facilitate the scheme upgrade.

style-src 'self' data: ; # Data-Uri in a CSS => OK 

In this example, the keyword data: authorizes embedded content in CSS files.

Under the CSP level 1 specification, you may also define rules for the following:

  • img-src

    valid sources of images
  • connect-src

    applies to XMLHttpRequest (AJAX), WebSocket or EventSource
  • font-src

    valid sources of fonts
  • object-src

    valid sources of plugins (for example, <object>, <embed>, <applet>)
  • media-src

    valid sources of <audio> and <video>

CSP level 2 rules include the following:

  • child-src

    valid sources of web workers and elements such as <frame> and <iframe> (this replaces the deprecated frame-src from CSP level 1)
  • form-action

    valid sources that can be used as an HTML <form> action
  • frame-ancestors

    valid sources for embedding the resource using <frame>, <iframe>, <object>, <embed> or <applet>.
  • upgrade-insecure-requests

    instructs user agents to rewrite URL schemes, changing HTTP to HTTPS (for websites with a lot of old URLs that need to be rewritten).

For better backwards-compatibility with deprecated properties, you may simply copy the contents of the actual directive and duplicate them in the deprecated one. For example, you may copy the contents of child-src and duplicate them in frame-src.

CSP 2 allows you to whitelist paths (CSP 1 allows only domains to be whitelisted). So, rather than whitelisting all of www.foo.com, you could whitelist www.foo.com/some/folder to restrict it further. This does require CSP 2 support in the browser, but it is obviously more secure.

An Example Link

I made a simple example for the Paris Web 2015 conference, where I presented a talk entitled “CSP in Action1.”

Without CSP, the page would look like this:

2
View large version3

Not very nice. What if we enabled the following CSP directives?

<?php header("Content-Security-Policy: default-src 'self' ; script-src 'self' www.google-analytics.com stats.g.doubleclick.net ; style-src 'self' data: ; img-src 'self' www.google-analytics.com stats.g.doubleclick.net data: ; frame-src 'self' ;"); ?>

What would the browser do? It would (very strictly) apply these directives under the primary rule of CSP, which is that anything not authorized in a CSP directive will be blocked (“blocked” meaning not executed, not displayed and not used by the website).

By default in CSP, inline scripts and styles are not authorized, which means that every <script>, onclick or style attribute will be blocked. You could authorize inline CSS with style-src 'unsafe-inline' ;.

In a modern browser with CSP support, the example would look like this:

This page with CSP, really better4
View large version5

What happened? The browser applied the directives and rejected anything that was not authorized. It sent these notifications to the console:

CSP notifications6
View large version7

If you’re still not convinced of the value of CSP, have a look at Aaron Gustafson’s article “More Proof We Don’t Control Our Web Pages8.”

Of course, you may use stricter directives than the ones in the example provided above:

  • set default-src to 'none',
  • specify what you need for each rule,
  • specify the exact paths of required files,
  • etc.

More Information On CSP Link

Support Link

CSP is not a nightly feature requiring three flags to be activated in order for it to work. CSP levels 1 and 2 are candidate recommendations! Browser support for CSP level 19 is excellent.

CSP Level 1 support on Can I Use10
View large version11

The level 2 specification is more recent12, so it is a bit less supported.

CSP Level 2 support on Can I Use13
View large version14

CSP level 3 is an early draft now, so it is not yet supported, but you can already do great things with levels 1 and 2.

Other Considerations Link

CSP has been designed to reduce cross-site scripting (XSS) risks, which is why enabling inline scripts in script-src directives is not recommended. Firefox illustrates this issue very nicely: In the browser, hit Shift + F2 and type security csp, and it will show you directives and advice. For example, here it is used on Twitter’s website:

CSP display on Firefox15
View large version16

Another possibility for inline scripts or inline styles, if you really have to use them, is to create a hash value. For example, suppose you need to have this inline script:

<script>alert('Hello, world.');</script>

You might add 'sha256-qznLcsROx4GACP2dm0UCKCzCG-HiZ1guq6ZZDob_Tng=' as a valid source in your script-src directives. The hash generated is the result of this in PHP:

<?phpecho base64_encode(hash('sha256', "alert('Hello, world.');", true)); ?>

I said earlier that CSP is designed to reduce XSS risks — I could have added, “… and reduce the risks of unsolicited content.” With CSP, you have to know where your sources of content are and what they are doing on your front end (inline styles, etc.). CSP can also help you force contributors, developers and others to respect your rules about sources of content!

Now your question is, “OK, this is great, but how do we use it in a production environment?”

How To Use It In The Real World Link

The easiest way to get discouraged with using CSP the first time is to test it in a live environment, thinking, “This will be easy. My code is bad ass and perfectly clean.” Don’t do this. I did it. It’s stupid, trust me.

As I explained, CSP directives are activated with a CSP header — there is no middle ground. You are the weak link here. You might forget to authorize something or forget a piece of code on your website. CSP will not forgive your oversight. However, two features of CSP greatly simplify this problem.

report-uri Link

Remember the notifications that CSP sends to the console? The directive report-uri can be used to tell the browser to send them to the specified address. Reports are sent in JSON format.

report-uri /csp-parser.php ; 

So, in the csp-parser.php file, we can process the data sent by the browser. Here is the most basic example in PHP:

$data = file_get_contents('php://input'); if ($data = json_decode($data, true)) { $data = json_encode( $data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ); mail(EMAIL, SUBJECT, $data); } 

This notification will be transformed into an email. During development, you might not need anything more complex than this.

For a production environment (or a more visited development environment), you’d better use a way other than email to collect information, because there is no auth or rate limiting on the endpoint, and CSP can be very noisy. Just imagine a page that generates 100 CSP notifications (for example, a script that display images from an unauthorized source) and that is viewed 100 times a day — you could get 10,000 notifications a day!

A service such as report-uri.io17 can be used to simplify the management of reporting. You can see other simple examples for report-uri18 (with a database, with some optimizations, etc.) on GitHub.

report-only Link

As we have seen, the biggest issue is that there is no middle ground between CSP being enabled and disabled. However, a feature named report-only sends a slightly different header:

<?php header("Content-Security-Policy-Report-Only: <your directives>"); ?>

Basically, this tells the browser, “Act as if these CSP directives were being applied, but do not block anything. Just send me the notifications.” It is a great way to test directives without the risk of blocking any required assets.

With report-only and report-uri, you can test CSP directives with no risk, and you can monitor in real time everything CSP-related on a website. These two features are really powerful for deploying and maintaining CSP!

Conclusion Link

Why CSP Is Cool Link

CSP is most important for your users: They don’t have to suffer any unsolicited scripts or content or XSS vulnerabilities on your website.

The most important advantage of CSP for website maintainers is awareness. If you’ve set strict rules for image sources, and a script kiddie attempts to insert an image on your website from an unauthorized source, that image will be blocked, and you will be notified instantly.

Developers, meanwhile, need to know exactly what their front-end code does, and CSP helps them master that. They will be prompted to refactor parts of their code (avoiding inline functions and styles, etc.) and to follow best practices.

How CSP Could Be Even Cooler Link

Ironically, CSP is too efficient in some browsers — it creates bugs with bookmarklets. So, do not update your CSP directives to allow bookmarklets. We can’t blame any one browser in particular; all of them have issues:

Most of the time, the bugs are false positives in blocked notifications. All browser vendors are working on these issues, so we can expect fixes soon. Anyway, this should not stop you from using CSP.

Other Resources And Articles Link

General Information Link

Dropbox’s Series on Its CSP Policies Link

GitHub’s CSP policies Link

Other Companies Link

About Reporting Link

Examples of Directives Link

The Future of CSP Link

(ds, il, al)

Footnotes Link

  1. 1 https://rocssti.net/en/example-csp-paris-web2015
  2. 2 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing1b.jpg
  3. 3 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing1b.jpg
  4. 4 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing5.jpg
  5. 5 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing5.jpg
  6. 6 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing2.jpg
  7. 7 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing2.jpg
  8. 8 https://www.aaron-gustafson.com/notebook/more-proof-we-dont-control-our-web-pages/
  9. 9 http://caniuse.com/#feat=contentsecuritypolicy
  10. 10 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing3.jpg
  11. 11 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing3.jpg
  12. 12 http://caniuse.com/#feat=contentsecuritypolicy2
  13. 13 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing4.jpg
  14. 14 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing4.jpg
  15. 15 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing6b.jpg
  16. 16 https://www.smashingmagazine.com/wp-content/uploads/2016/09/csp_smashing6b.jpg
  17. 17 https://report-uri.io/
  18. 18 https://github.com/nico3333fr/CSP-useful/tree/master/report-uri
  19. 19 https://bugzilla.mozilla.org/show_bug.cgi?id=866522
  20. 20 https://bugs.chromium.org/p/chromium/issues/detail?id=233903
  21. 21 https://bugs.webkit.org/show_bug.cgi?id=149000
  22. 22 http://content-security-policy.com/
  23. 23 http://www.w3.org/TR/CSP/
  24. 24 http://www.html5rocks.com/en/tutorials/security/content-security-policy/
  25. 25 https://securityheaders.io/
  26. 26 https://github.com/nico3333fr/CSP-useful
  27. 27 https://cspvalidator.org/
  28. 28 https://www.w3.org/TR/upgrade-insecure-requests/
  29. 29 https://scotthelme.co.uk/csp-cheat-sheet/
  30. 30 https://blogs.dropbox.com/tech/2015/09/on-csp-reporting-and-filtering/
  31. 31 https://blogs.dropbox.com/tech/2015/09/unsafe-inline-and-nonce-deployment/
  32. 32 https://blogs.dropbox.com/tech/2015/09/csp-the-unexpected-eval/
  33. 33 https://blogs.dropbox.com/tech/2015/09/csp-third-party-integrations-and-privilege-separation/
  34. 34 http://githubengineering.com/githubs-csp-journey/
  35. 35 https://www.wired.com/2016/05/wired-first-big-https-rollout-snag/
  36. 36 https://corner.squareup.com/2016/05/content-security-policy-single-page-app.html
  37. 37 https://oreoshake.github.io/csp/twitter/2014/07/25/twitters-csp-report-collector-design.html
  38. 38 https://github.com/nico3333fr/CSP-useful/tree/master/csp-for-third-party-services
  39. 39 https://speakerdeck.com/mikispag/making-csp-great-again-michele-spagnuolo-and-lukas-weichselbaum
  40. 40 https://www.w3.org/TR/CSP3/
  41. 41 https://github.com/w3c/webappsec-csp/
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to topTweet itShare on Facebook

Advertisement

The Mac Manual

Get Started

Welcome Back, ().

at

Has your work information changed?

Welcome

Please review the fields below for completeness and accuracy prior to submitting.

Welcome Back, ().

Has your work information changed?

Please Correct the Highlighted Fields Below:

Complete the form below:















Yes No

The Windows 7 Guide: From Newbies to Pros

Get Started

Welcome Back, ().

at

Has your work information changed?

Welcome

Please review the fields below for completeness and accuracy prior to submitting.

Welcome Back, ().

Has your work information changed?

Please Correct the Highlighted Fields Below:

Complete the form below:















Yes No

The Beginner’s Guide to Joomla

Get Started

Welcome Back, ().

at

Has your work information changed?

Welcome

Please review the fields below for completeness and accuracy prior to submitting.

Welcome Back, ().

Has your work information changed?

Please Correct the Highlighted Fields Below:

Complete the form below:















Yes No

Using the Magic Pocket: A Dropbox Guide

Get Started

Welcome Back, ().

at

Has your work information changed?

Welcome

Please review the fields below for completeness and accuracy prior to submitting.

Welcome Back, ().

Has your work information changed?

Please Correct the Highlighted Fields Below:

Complete the form below:















Yes No

The Awesome Automation Guide for Macs

Get Started

Welcome Back, ().

at

Has your work information changed?

Welcome

Please review the fields below for completeness and accuracy prior to submitting.

Welcome Back, ().

Has your work information changed?

Please Correct the Highlighted Fields Below:

Complete the form below:















Yes No

Your PC, Inside and Out: Part 1 – Chassis, Power Supply and Motherboard

Get Started

Welcome Back, ().

at

Has your work information changed?

Welcome

Please review the fields below for completeness and accuracy prior to submitting.

Welcome Back, ().

Has your work information changed?

Please Correct the Highlighted Fields Below:

Complete the form below:















Yes No

Your PC, Inside and Out: Part 2 CPU, RAM, Storage, Video Card and Expansions

Get Started

Welcome Back, ().

at

Has your work information changed?

Welcome

Please review the fields below for completeness and accuracy prior to submitting.

Welcome Back, ().

Has your work information changed?

Please Correct the Highlighted Fields Below:

Complete the form below:















Yes No

Windows… On Speed

Get Started

Welcome Back, ().

at

Has your work information changed?

Welcome

Please review the fields below for completeness and accuracy prior to submitting.

Welcome Back, ().

Has your work information changed?

Please Correct the Highlighted Fields Below:

Complete the form below:















Yes No

How To Scale React Applications

How To Scale React Applications

We recently released version 3 of React Boilerplate1, one of the most popular React starter kits, after several months of work. The team spoke with hundreds of developers about how they build and scale their web applications, and I want to share some things we learned along the way.

2
The tweet that announced3 the release of version 3 of React Boilerplate

We realized early on in the process that we didn’t want it to be “just another boilerplate.” We wanted to give developers who were starting a company or building a product the best foundation to start from and to scale.

Traditionally, scaling was mostly relevant for server-side systems. As more and more users would use your application, you needed to make sure that you could add more servers to your cluster, that your database could be split across multiple servers, and so on.

Nowadays, due to rich web applications, scaling has become an important topic on the front end, too! The front end of a complex app needs to be able to handle a large number of users, developers and parts. These three categories of scaling (users, developers and parts) need to be accounted for; otherwise, there will be problems down the line.

Containers And Components Link

The first big improvement in clarity for big applications is the differentiation between stateful (“containers”) and stateless (“components”) components. Containers manage data or are connected to the state and generally don’t have styling associated with them. On the other hand, components have styling associated with them and aren’t responsible for any data or state management. I found this confusing at first. Basically, containers are responsible for how things work, and components are responsible for how things look.

Splitting our components like this enables us to cleanly separate reusable components and intermediary layers of data management. As a result, you can confidently go in and edit your components without worrying about your data structures getting messed up, and you can edit your containers without worrying about the styling getting messed up. Reasoning through and working with your application become much easier that way, the clarity being greatly improved!

Structure Link

Traditionally, developers structured their React applications by type. This means they had folders like actions/, components/, containers/, etc.

Imagine a navigation bar container named NavBar. It would have some state associated with it and a toggleNav action that opens and closes it. This is how the files would be structured when grouped by type:

react-app-by-type ├── css ├── actions │ └── NavBarActions.js ├── containers │ └── NavBar.jsx ├── constants │ └── NavBarConstants.js ├── components │ └── App.jsx └── reducers └── NavBarReducer.js

While this works fine for examples, once you have hundreds or potentially thousands of components, development becomes very hard. To add a feature, you would have to search for the correct file in half a dozen different folders with thousands of files. This would quickly become tedious, and confidence in the code base would wane.

After a long discussion in our GitHub issues tracker and trying out a bunch of different structures, we believe we have found a much better solution:

Instead of grouping the files of your application by type, group them by feature! That is, put all files related to one feature (for example, the navigation bar) in the same folder.

Let’s look at what the folder structure would look like for our NavBar example:

react-app-by-feature ├── css ├── containers │ └── NavBar │ ├── NavBar.jsx │ ├── actions.js │ ├── constants.js │ └── reducer.js └── components └── App.jsx

Developers working on this application would need to go into only a single folder to work on something. And they would need to create only a single folder to add a new feature. Renaming is easy with find and replace, and hundreds of developers could work on the same application at once without causing any conflicts!

When I first read about this way of writing React applications, I thought, “Why would I ever do that? The other way works absolutely fine!” I pride myself on keeping an open mind, though, so I tried it on a small project. I was smitten within 15 minutes. My confidence in the code base was immense, and, with the container-component split, working on it was a breeze.

It’s important to note that this doesn’t mean the redux actions and reducers can only be used in that component. They can (and should) be imported and used from other components!

Two questions popped into my head while working like this, though: “How do we handle styling?” and “How do we handle data-fetching?” Let me tackle these separately.

Styling Link

Apart from architectural decisions, working with CSS in a component-based architecture is hard due to two specific properties of the language itself: global names and inheritance.

Unique Class Names Link

Imagine this CSS somewhere in a large application:

.header { /* … */ } .title { background-color: yellow; }

Immediately, you’ll recognize a problem: title is a very generic name. Another developer (or maybe even the same one some time later) might go in and write this code:

.footer { /* … */ } .title { border-color: blue; }

This will create a naming conflict, and suddenly your title will have a blue border and a yellow background everywhere, and you’ll be digging into thousands of files to find the one declaration that has messed everything up!

Thankfully, a few smart developers have come up with a solution to this problem, which they’ve named CSS Modules4. The key to their approach is to co-locate the styles of a component in their folder:

react-app-with-css-modules ├── containers └── components └── Button ├── Button.jsx └── styles.css

The CSS looks exactly the same, except that we don’t have to worry about specific naming conventions, and we can give our code quite generic names:

.button { /* … */ }

We then require (or import) these CSS files into our component and assign our JSX tag a className of styles.button:

/* Button.jsx */ var styles = require('./styles.css'); <div className={styles.button}></div> 

If you now look into the DOM in the browser, you’ll see <div></div>! CSS Modules takes care of “uniquifying” our class names by prepending the application’s name and postpending a short hash of the contents of the class. This means that the chance of overlapping classes is almost nil, and if they overlap, they will have the same contents anyway (because the hash — that is, the contents — has to be the same).

Reset Properties For Each Component Link

In CSS, certain properties inherit across nodes. For example, if the parent node has a line-height set and the child doesn’t have anything specified, it will automatically have the same line-height applied as the parent.

In a component-based architecture, that’s not what we want. Imagine a Header component and a Footer component with these styles:

.header { line-height: 1.5em; /* … */ } .footer { line-height: 1; /* … */ }

Let’s say we render a Button inside these two components, and suddenly our buttons look different in the header and footer of our page! This is true not only for line-height: About a dozen CSS properties will inherit, and tracking down and getting rid of those bugs in your application would be very hard.

In the front-end world, using a reset style sheet to normalize styles across browsers is quite common. Popular options include Reset CSS, Normalize.css and sanitize.css! What if we took that concept and had a reset for every component?

This is called an auto-reset, and it exists as a plugin for PostCSS5! If you add PostCSS Auto Reset6 to your PostCSS plugins, it’ll do this exactly: wrap a local reset around each component, setting all inheritable properties to their default values to override the inheritances.

Data-Fetching Link

The second problem associated with this architecture is data-fetching. Co-locating your actions to your components makes sense for most actions, but data-fetching is inherently a global action that’s not tied to a single component!

Most developers at the moment use Redux Thunk7 to handle data-fetching with Redux. A typical thunked action would look something like this:

/* actions.js */ function fetchData() { return function thunk(dispatch) { // Load something asynchronously. fetch('https://someurl.com/somendpoint', function callback(data) { // Add the data to the store. dispatch(dataLoaded(data)); }); } }

This is a brilliant way to allow data-fetching from the actions, but it has two pain points: Testing those functions is very hard, and, conceptually, having data-fetching in the actions doesn’t quite seem right.

A big benefit of Redux is the pure action creators, which are easily testable. When returning a thunk from an action, suddenly you have to double-call the action, mock the dispatch function, etc.

Recently, a new approach has taken the React world by storm: redux-saga8. redux-saga utilizes Esnext generator functions to make asynchronous code look synchronous, and it makes those asynchronous flows very easy to test. The mental model behind sagas is that they are like a separate thread in your application that handles all asynchronous things, without bothering the rest of the application!

Let me illustrate with an example:

/* sagas.js */ import { call, take, put } from 'redux-saga/effects'; // The asterisk behind the function keyword tells us that this is a generator. function* fetchData() { // The yield keyword means that we'll wait until the (asynchronous) function // after it completes. // In this case, we wait until the FETCH_DATA action happens. yield take(FETCH_DATA); // We then fetch the data from the server, again waiting for it with yield // before continuing. var data = yield call(fetch, 'https://someurl.com/someendpoint'); // When the data has finished loading, we dispatch the dataLoaded action. put(dataLoaded(data)); }

Don’t be scared by the strange-looking code: This is a brilliant way to handle asynchronous flows!

The source code above almost reads like a novel, avoids callback hell and, on top of that, is easy to test. Now, you might ask yourself, why is it easy to test? The reason has to do with our ability to test for the “effects” that redux-saga exports without needing them to complete.

These effects that we import at the top of the file are handlers that enable us to easily interact with our redux code:

  • put() dispatches an action from our saga.
  • take() pauses our saga until an action happens in our app.
  • select() gets a part of the redux state (kind of like mapStateToProps).
  • call() calls the function passed as the first argument with the remaining arguments.

Why are these effects useful? Let’s see what the test for our example would look like:

/* sagas.test.js */ var sagaGenerator = fetchData(); describe('fetchData saga', function() { // Test that our saga starts when an action is dispatched, // without having to simulate that the dispatch actually happened! it('should wait for the FETCH_DATA action', function() { expect(sagaGenerator.next()).to.equal(take(FETCH_DATA)); }); // Test that our saga calls fetch with a specific URL, // without having to mock fetch or use the API or be connected to a network! it('should fetch the data from the server', function() { expect(sagaGenerator.next()).to.equal(call(fetch, 'https://someurl.com/someendpoint')); }); // Test that our saga dispatches an action, // without having to have the main application running! it('should dispatch the dataLoaded action when the data has loaded', function() { expect(sagaGenerator.next()).to.equal(put(dataLoaded())); }); });

Esnext generators don’t go past the yield keyword until generator.next() is called, at which point they run the function, until they encounter the next yield keyword! By using the redux-saga effects, we can thus easily test asynchronous things without needing to mock anything and without relying on the network for our tests.

By the way, we co-locate the test files to the files we are testing, too. Why should they be in a separate folder? That way, all of the files associated with a component are truly in the same folder, even when we’re testing things!

If you think this is where the benefits of redux-saga end, you’d be mistaken! In fact, making data-fetching easy, beautiful and testable might be its smallest benefits!

Using redux-saga as Mortar Link

Our components are now decoupled. They don’t care about any other styling or logic; they are concerned solely with their own business — well, almost.

Imagine a Clock and a Timer component. When a button on the clock is pressed, we want to start the timer; and when the stop button on the timer is pressed, you want to show the time on the clock.

Conventionally, you might have done something like this:

/* Clock.jsx */ import { startTimer } from '../Timer/actions'; class Clock extends React.Component { render() { return ( /* … */ <button onClick={this.props.dispatch(startTimer())} /> /* … */ ); } }
/* Timer.jsx */ import { showTime } from '../Clock/actions'; class Timer extends React.Component { render() { return ( /* … */ <button onClick={this.props.dispatch(showTime(currentTime))} /> /* … */ ); } }

Suddenly, you cannot use those components separately, and reusing them becomes almost impossible!

Instead, we can use redux-saga as the “mortar” between these decoupled components, so to speak. By listening for certain actions, we can react (pun intended) in different ways, depending on the application, which means that our components are now truly reusable.

Let’s fix our components first:

/* Clock.jsx */ import { startButtonClicked } from '../Clock/actions'; class Clock extends React.Component { /* … */ <button onClick={this.props.dispatch(startButtonClicked())} /> /* … */ }
/* Timer.jsx */ import { stopButtonClicked } from '../Timer/actions'; class Timer extends React.Component { /* … */ <button onClick={this.props.dispatch(stopButtonClicked(currentTime))} /> /* … */ }

Notice how each component is concerned only with itself and imports only its own actions!

Now, let’s use a saga to tie those two decoupled components back together:

/* sagas.js */ import { call, take, put, select } from 'redux-saga/effects'; import { showTime } from '../Clock/actions'; import { START_BUTTON_CLICKED } from '../Clock/constants'; import { startTimer } from '../Timer/actions'; import { STOP_BUTTON_CLICKED } from '../Timer/constants'; function* clockAndTimer() { // Wait for the startButtonClicked action of the Clock // to be dispatched. yield take(START_BUTTON_CLICKED); // When that happens, start the timer. put(startTimer()); // Then, wait for the stopButtonClick action of the Timer // to be dispatched. yield take(STOP_BUTTON_CLICKED); // Get the current time of the timer from the global state. var currentTime = select(function (state) { return state.timer.currentTime }); // And show the time on the clock. put(showTime(currentTime)); }

Beautiful.

Summary Link

Here are the key takeaways for you to remember:

  • Differentiate between containers and components.
  • Structure your files by feature.
  • Use CSS modules and PostCSS Auto Reset.
  • Use redux-saga to:
    • have readable and testable asynchronous flows,
    • tie together your decoupled components.

(il, vf, al)

Footnotes Link

  1. 1 https://github.com/mxstbr/react-boilerplate
  2. 2 https://twitter.com/mxstbr/status/732833839140229120
  3. 3 https://twitter.com/mxstbr/status/732833839140229120
  4. 4 https://github.com/css-modules/css-modules
  5. 5 http://postcss.org/
  6. 6 https://github.com/maximkoretskiy/postcss-autoreset
  7. 7 https://github.com/gaearon/redux-thunk
  8. 8 https://github.com/yelouafi/redux-saga
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to topTweet itShare on Facebook

Advertisement

Breaking Out Of The Box: Design Inspiration (September 2016)

Breaking Out Of The Box: Design Inspiration (September 2016)

Inspiration isn’t tied to a specific timeframe or shows up when you need it. There isn’t a magic formula to rely on. Luckily, this year’s summer vacation was fruitful in providing us with many visual stimuli to get the creative process going. Enjoy!

The Hollywood Reporter Link

This editorial illustration for the Hollywood Reporter has a really nice style. The face expressions are so well done with just a few simple lines. That’s not easy to accomplish!

1
Image credit: Ale Giorgini2. (Large preview3)

Wanderlust Alphabet #A Link

A fantastic series to get the travel bug. Just by looking at this you’ve probably already guessed that the ‘A’ in this case stands for ‘Amsterdam’. Lovely usage of two complimentary colors cleverly applied, especially to add depth into shadows and highlights.

4
Image credit: Jack Daly5. (Large preview6)

Wanderlust Alphabet #B Link

Second installment of the travel bug illustrations I’ll be sure to follow. The letter ‘B’ stands for ‘BarcelonaÄ. Again, look at how depth is created by using a strong color palette and this beautiful clean 2D style. The famous parts of this city are so well done with such simple lines.

7
Image credit: Jack Daly8. (Large preview9)

Giphy Pool Link

James Curran is one of the masters of animated gifs to watch. This one made laugh and is so colorfully pleasant. And look at that jump! Just perfect.


Image credit: James Curran10>

Slack — Work Simplified Link

Great integration of the colors used by Slack11. It shows how crazy work life is. Beautiful illustration style. Just perfect branding material.

12
Image credit: Multiple Owners13. (Large preview14)

Stamps Inspired (1965) Link

Illustration based on original stamps from Bulgaria. Quite beautiful! I love the bright yellow in combination with the darker color, as well as the red and orange tones.

15
Image credit: Fe Ribeiro16. (Large preview17)

Saga Magazine Link

I first noticed the interesting structure/texture that works so well with the chosen colors. Love the circles, and ‘straight’ 90° lines — very geometrical. Feels a bit like a puzzle.

18
Image credit: Jonny Wan19. (Large preview20)

Vans Surf Pro Classic Link

The colors just pop so magnificently off the screen in this surf-related illustration. Very fitting for the subject. Inspiration came from late 80s and 90s surf artwork.

21
Image credit: Ian Jepson22. (Large preview23)

Firenze Duomo Link

Lovely illustration of the Duomo in Florence. Color palette is on point. Tasty texture, too. Simply beautiful to look at and get inspired.

24
Image credit: Bailey Sullivan25. (Large preview26)

In The Woods Link

Well taken shot of one of my favorite moments in the month of May. The smell is just overwhelming of these beautiful bluebells. Magical light and bokeh.

27
Image credit: Kirstin Mckee28. (Large preview29)

Mastercard Campaign Link

Some clever use of white space. The dog is just so awesomely done.

30
Image credit: Stephen Kelleher31. (Large preview32)

City Bike Miami Link

Love the eyes and the illusion of the hair in the wind. Same with the dog ears, so cute. That lovely summer feeling on the bike! Perfectly expressed.

33
Image credit: Pietari Posti34. (Large preview35)

Umami Link

An illustration which takes on curiosity and exploration of different tastes and flavors. It’s a great composition and an inspiring color palette.

36
Image credit: Aleksandar Savić1054337. (Large preview38)

Cinque Terre Link

Great color scheme! Illustration that documents a trip to Italy to see Cinque Terre. It’s a must-see apparently. The geometry combined with how the colors are applied is just so perfect.

39
Image credit: Bailey Sullivan40. (Large preview41)

Protected Trees Link

An illustration for The Telegraph‘s property section on buying a home with protected trees in vicinity. Some inspiring choices of shapes and lines.

42
Image credit: Aleksandar Savić1054337. (Large preview44)

Shop Magazine — Eye Blue Link

If you like interesting collages, you’ll love the work of Jimmy Turell. The colors and the half-tone effects are the items that made me pick this one.

45
Image credit: Jimmy Turell46. (Large preview47)

Year In Ideas (2014) Link

Created for Wired48. Another color combo that works wonderfully well together. I always look at how things are constructed, and I’m quite impressed by this illustration.

49
Image credit: Vesa Sammalisto50. (Large preview51)

The Westfjords Link

Beautiful colors of the sky — almost like fire.

52
Image credit: Conor MacNeill53. (Large preview54)

Saison Link

Wonderful die cut beer label design. I always admire such great lettering work. Be sure to check the rest of Ben Didier’s the portfolio55 as there is some stellar lettering work in there.

56
Image credit: Ben Didier57. (Large preview58)

Wanderlust Alphabet #C Link

The third installment in the Wanderlust alphabet that Jack Daly is creating. This time I believe the ‘C’ stands for ‘Copenhagen’. Interesting palette of colors in this one.

59
Image credit: Jack Daly60. (Large preview61)

No-Li Small Batch Festival Link

Nice logo for the No-Li Brewhouse’s Small Batch Festival. The different styles of typefaces really work well together. Beautiful and elegant!

62
Image credit: Riley Cran63. (Large preview64)

SHOP Magazine Austria Spring/Summer 2016 Link

The cover illustration for the spring edition of SHOP magazine in Austria. It depicts the Museum quarter of Vienna. Lovely combination of geometrical and elegant organic lines. Such perfect soft color tones combined with a few more brighter accents.

65
Image credit: Andrew Lyons66. (Large preview67)

Girl On The Go Link

Such a wonderful scene! Especially the colors used and the inspiring details such as the skirt of the woman and the boots of the guy sitting on the bench on the right.

68
Image credit: Steve Scott69. (Large preview70)

Wanderlust Alphabet #D Link

The fourth installment in the Wanderlust alphabet that Jack Daly is creating. This time the ‘D’ stands for ‘Dublin’. Just look at how shadows and highlights are applied — such perfect contrast.

71
Image credit: Jack Daly72. (Large preview73)

An Afternoon At Miticocha Link

Well worth a two-hour round-trip hike I would say if you get to see a scenery like this. This place has a beautiful view of Ninachanca, Jirishanca, and Jirishanca Chico. Pure wanderlust!

74
Image credit: Zolashine75. (Large preview76)

Ponderosa 2016 Link

Not just because there’s a bicycle in it 😉 Most of all picked because it has a wonderful composition with fine details.

77
Image credit: Mads Berg78. (Large preview79)

Music Girls Link

A wonderful fusion between contemporary and retro. Some inspiring texture work going on in there as well. The wooden floor and the little details on the faces — look at those eyes!

80
Image credit: Loris Lora81. (Large preview82)

Facebook Events — Naomi Link

Part of a set of illustrations created for Facebook’s event cover images. Totally loving these colors! Lovely simplistic style, too.

83
Image credit: Naomi Wilkinson84. (Large preview85)

Hiding Behind Mom Link

A great example of what is possible with a few pencil strokes. The socks on the girl are adorable.

86
Image credit: Simona Ciraolo87. (Large preview88)

Look Around Link

An illustration to get the travel bug going. Great style and subtle usage of textures. For a touristic guide of the Garda Lake.

89
Image credit: Federica Bordoni90. (Large preview91)

Summertime Link

“Let the waves hit your feet and the sand be your seat!” Exactly. I love compositions where there is much to discover. Great mix of colors.

92
Image credit: Putri Febriana93. (Large preview94)

Summer Bike Ride Link

Love how the diagonal line adds to the whole composition. Subtle use of shadows and transparency. Such perfect curved lines, especially hair and hat are done so perfectly in every way. Looking at this makes me want to go outside and ride.

95
Image credit: Tjeerd Broere96. (Large preview97)

Wanderlust Alphabet #E Link

The fifth installment in the Wanderlust alphabet that Jack Daly is creating. This time the ‘E’ stands for ‘Edinburgh’. The color treatment is great again. So many good details.

98
Image credit: Jack Daly99. (Large preview100)

American Illustration 33 Link

Super clean and the character really gets your attention. Love how the stockings are done. So simple, yet so elegant.

101
Image credit: Federica Bordoni102. (Large preview103)

Procesni Mehanize Link

Illustrating the never-ending cycle. I always love to analyze the many elements that make a fantastic illustration. You can learn a lot from it.

104
Image credit: Aleksandar Savić1054337. (Large preview106)

Blossom Link

One of the hardest things to get right is shooting directly into sunlight. This one nails it beautifully. Summer vibes!

107
Image credit: Anders Jildén108. (Large preview109)

Focus Magazine Illustration Link

Adorable cuteness and great usage of some basic shapes. Look at that cute mustache of the guy on the left. The color palette is absolutely perfect.

110
Image credit: Loulou and Tummie111. (Large preview112)

The Joy Of New Roads Link

Getting out on your bicycle and discovering new roads and amazing sceneries is a joy hard to describe in words. Lovely light in this photo.

113
Image credit: David Marcu114. (Large preview115)

City Guide Berlin-London-Paris Link

Inspiring arrangement of all the different items in this composition. Beautiful 2D style with lovely subtle textures and patterns to finish things off. The colors also draw you in.

116
Image credit: Maite Franchi117. (Large preview118)

Velorama — Lightyear Link

Love the combination of line art and typography. Looks so elegant! The bike is so well drawn. It shines! Look at the frame, the handlebars and the saddle.

119
Image credit: Silence TV120. (Large preview121)

Els Amos Ocults Del Totxo Link

The Brickmasters in the Shadows. Great editorial illustration. The duplication of the gentleman withthe hat is the eye-catcher. The chosen colors make the whole scene complete.

122
Image credit: Raúl Soria123. (Large preview124)

Bison Link

Right on target! Love what is done with the lines here.

125
Image credit: Matt Carlson126. (Large preview127)

No Man’s Sky Link

Pretty fly! It looks highly complicated but is quite simplistic at the same time. The color scheming is on point, too. The subtle background gradient is so perfect.

128
Image credit: Justin Mezzell129. (Large preview130)

FiveThirtyEight Election Link

This looks fantastic! The many layers of typography are so inspiring.

131
Image credit: Bethany Heck132. (Large preview133)

The Secret To Sleep Link

Lovely muted color palette for starters and some subtle textures work in combination with double shading makes this interesting. I really love the imagination and fantasy.

134
Image credit: Owen Davey135. (Large preview136)

On Geoengineering Link

Created for an editorial piece about geoengineering. Love how it all has been translated to the screen.

137
Image credit: Raúl Soria138. (Large preview139)

Bicycle Adventure Meeting (BAM) Link

In my opinion, a bit of humor always adds something special to any illustration. This one is about the Bicycle Adventure Meeting, a place where lonely, adventurous bike travelers join together. The lovely bright colors give this illustration a happy feeling.

140
Image credit: Fabio Consoli141. (Large preview142)

Brooklyn Bridge Link

Well captured! The tranquility of the water is what does it for me. Just the right shutter speed I’m assuming to get the effect.

143
Image credit: Alexander Rotker144. (Large preview145)

SHOP Magazine — Czech Republic Link

Charming textured style and an inspiring color palette.

146
Image credit: Maïté Franchi147. (Large preview148)

Bicycling Magazine Link

Editorial illustration for an article on the importance of teamwork when learning road biking. I like how the three guys are nicely aligned and how the legs are drawn. As an illustrator, you have the freedom to break with reality in order to achieve beautiful compositions.

149
Image credit: Douglas Jones150. (Large preview151)

(yk, il)

Footnotes Link

  1. 1 https://www.smashingmagazine.com/wp-content/uploads/2016/09/hollywood-reporter-ale-big-opt.jpg
  2. 2 https://www.behance.net/gallery/41166307/Editorial-Illustration-vol-1
  3. 3 https://www.smashingmagazine.com/wp-content/uploads/2016/09/hollywood-reporter-ale-big-opt.jpg
  4. 4 https://www.smashingmagazine.com/wp-content/uploads/2016/09/wanderlust-series-A-big-opt.jpg
  5. 5 https://dribbble.com/shots/2872483-Wanderlust-Alphabet
  6. 6 https://www.smashingmagazine.com/wp-content/uploads/2016/09/wanderlust-series-A-big-opt.jpg
  7. 7 https://www.smashingmagazine.com/wp-content/uploads/2016/09/wanderlust-series-B-big-opt.jpg
  8. 8 https://dribbble.com/shots/2874109-Wanderlust-Alphabet
  9. 9 https://www.smashingmagazine.com/wp-content/uploads/2016/09/wanderlust-series-B-big-opt.jpg
  10. 10 https://dribbble.com/shots/2836393-LA-Gifathon-Day-13
  11. 11 https://slack.com/
  12. 12 https://www.smashingmagazine.com/wp-content/uploads/2016/09/work-simplified-slack-big-opt.jpg
  13. 13 https://www.behance.net/gallery/40894619/Slack-Work-Simplified
  14. 14 https://www.smashingmagazine.com/wp-content/uploads/2016/09/work-simplified-slack-big-opt.jpg
  15. 15 https://www.smashingmagazine.com/wp-content/uploads/2016/09/stamps-inspired-bulgaria-big-opt.jpg
  16. 16 https://dribbble.com/shots/2876067-STAMPS-INSPIRED
  17. 17 https://www.smashingmagazine.com/wp-content/uploads/2016/09/stamps-inspired-bulgaria-big-opt.jpg
  18. 18 https://www.smashingmagazine.com/wp-content/uploads/2016/09/saga-magazine-big-opt.jpg
  19. 19 https://www.behance.net/gallery/41111981/Selected-Editorial-Work-01
  20. 20 https://www.smashingmagazine.com/wp-content/uploads/2016/09/saga-magazine-big-opt.jpg
  21. 21 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Vans-Surf-Pro-Classic-big-opt.jpg
  22. 22 https://www.behance.net/gallery/41053301/Vans-Surf-Pro-Classic
  23. 23 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Vans-Surf-Pro-Classic-big-opt.jpg
  24. 24 https://www.smashingmagazine.com/wp-content/uploads/2016/09/firenze-duomo-big-opt.jpg
  25. 25 https://dribbble.com/shots/2635802-Firenze
  26. 26 https://www.smashingmagazine.com/wp-content/uploads/2016/09/firenze-duomo-big-opt.jpg
  27. 27 https://www.smashingmagazine.com/wp-content/uploads/2016/09/in-the-woods-big-opt.jpg
  28. 28 https://www.flickr.com/photos/kirstinmckee/27120293751/
  29. 29 https://www.smashingmagazine.com/wp-content/uploads/2016/09/in-the-woods-big-opt.jpg
  30. 30 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Mastercard-campaign-big-opt.jpg
  31. 31 http://www.stephenkelleher.com/Mastercard-1
  32. 32 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Mastercard-campaign-big-opt.jpg
  33. 33 https://www.smashingmagazine.com/wp-content/uploads/2016/09/city-bike-miami-big-opt.jpg
  34. 34 http://agentpekka.com/artist/pietari-posti/citi-bike-miami-4/
  35. 35 https://www.smashingmagazine.com/wp-content/uploads/2016/09/city-bike-miami-big-opt.jpg
  36. 36 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Umami-big-opt.jpg
  37. 37 https://www.behance.net/gallery/41466863/Various-illustrations-2016
  38. 38 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Umami-big-opt.jpg
  39. 39 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Cinque-Terre-big-opt.jpg
  40. 40 https://dribbble.com/shots/2872019-Cinque-Terre
  41. 41 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Cinque-Terre-big-opt.jpg
  42. 42 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Protected-trees-big-opt.jpg
  43. 43 https://www.behance.net/gallery/41466863/Various-illustrations-2016
  44. 44 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Protected-trees-big-opt.jpg
  45. 45 https://www.smashingmagazine.com/wp-content/uploads/2016/09/eye-blue-big-opt.jpg
  46. 46 http://www.jimmyturrell.com/2011/09/19/various-collages/
  47. 47 https://www.smashingmagazine.com/wp-content/uploads/2016/09/eye-blue-big-opt.jpg
  48. 48 http://www.wired.com/
  49. 49 https://www.smashingmagazine.com/wp-content/uploads/2016/09/year-in-ideas-2014-big-opt.jpg
  50. 50 http://www.vesa-s.com/Wired-1
  51. 51 https://www.smashingmagazine.com/wp-content/uploads/2016/09/year-in-ideas-2014-big-opt.jpg
  52. 52 https://www.smashingmagazine.com/wp-content/uploads/2016/09/The-Westfjords-big-opt.jpg
  53. 53 https://www.flickr.com/photos/thefella/9155895849/
  54. 54 https://www.smashingmagazine.com/wp-content/uploads/2016/09/The-Westfjords-big-opt.jpg
  55. 55 https://dribbble.com/prettyuglydesign
  56. 56 https://www.smashingmagazine.com/wp-content/uploads/2016/09/saison-big-opt.jpg
  57. 57 https://dribbble.com/shots/2139224-Saison
  58. 58 https://www.smashingmagazine.com/wp-content/uploads/2016/09/saison-big-opt.jpg
  59. 59 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Wanderlust-Alphabet-C-big-opt.jpg
  60. 60 https://dribbble.com/shots/2881262-Travel-Letters-C-Dribbble
  61. 61 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Wanderlust-Alphabet-C-big-opt.jpg
  62. 62 https://www.smashingmagazine.com/wp-content/uploads/2016/09/no-li-small-batch-big-opt.jpg
  63. 63 http://www.2016.rileycran.com/#/no-li-small-batch-festival/
  64. 64 https://www.smashingmagazine.com/wp-content/uploads/2016/09/no-li-small-batch-big-opt.jpg
  65. 65 https://www.smashingmagazine.com/wp-content/uploads/2016/09/shop-magazine-austria-big-opt.jpg
  66. 66 http://www.lyonsa.com/SHOP-magazine-Austria
  67. 67 https://www.smashingmagazine.com/wp-content/uploads/2016/09/shop-magazine-austria-big-opt.jpg
  68. 68 https://www.smashingmagazine.com/wp-content/uploads/2016/09/girl-on-the-go-big-opt.jpg
  69. 69 https://www.behance.net/gallery/41530311/Editorial-projects-june-july-2016
  70. 70 https://www.smashingmagazine.com/wp-content/uploads/2016/09/girl-on-the-go-big-opt.jpg
  71. 71 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Wanderlust-Alphabet-D-big-opt.jpg
  72. 72 https://dribbble.com/shots/2885564-Wanderlust-Alphabet-D
  73. 73 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Wanderlust-Alphabet-D-big-opt.jpg
  74. 74 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Miticocha-big-opt.jpg
  75. 75 https://www.flickr.com/photos/zolashine/27570839274/
  76. 76 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Miticocha-big-opt.jpg
  77. 77 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Ponderosa-2016-big-opt.jpg
  78. 78 https://www.behance.net/gallery/41404221/Ponderosa-2016
  79. 79 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Ponderosa-2016-big-opt.jpg
  80. 80 https://www.smashingmagazine.com/wp-content/uploads/2016/09/music-girls-big-opt.jpg
  81. 81 http://www.lorislora.com/First-Aid-Kit
  82. 82 https://www.smashingmagazine.com/wp-content/uploads/2016/09/music-girls-big-opt.jpg
  83. 83 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Facebook-Events-Naomi-big-opt.jpg
  84. 84 http://naomiwilkinson.co.uk/Facebook-Events
  85. 85 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Facebook-Events-Naomi-big-opt.jpg
  86. 86 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Hiding-behind-mom-big-opt.jpg
  87. 87 http://simonaciraolo.com/illustration/
  88. 88 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Hiding-behind-mom-big-opt.jpg
  89. 89 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Garda-Lake-tourist-guide-big-opt.jpg
  90. 90 https://www.behance.net/gallery/11760603/Look-Around
  91. 91 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Garda-Lake-tourist-guide-big-opt.jpg
  92. 92 https://www.smashingmagazine.com/wp-content/uploads/2016/09/summertime-putri-big-opt.jpg
  93. 93 https://www.behance.net/gallery/24118509/Summertime
  94. 94 https://www.smashingmagazine.com/wp-content/uploads/2016/09/summertime-putri-big-opt.jpg
  95. 95 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Summer-bike-ride-tjeerd-big-opt.jpg
  96. 96 https://dribbble.com/shots/2909923-Summer
  97. 97 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Summer-bike-ride-tjeerd-big-opt.jpg
  98. 98 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Wanderlust-Alphabet-E-big-opt.jpg
  99. 99 https://dribbble.com/shots/2893203-Wanderlust-Alphabet-E
  100. 100 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Wanderlust-Alphabet-E-big-opt.jpg
  101. 101 https://www.smashingmagazine.com/wp-content/uploads/2016/09/American-Illustration-33-big-opt.jpg
  102. 102 https://www.behance.net/gallery/16752439/American-Illustration-33
  103. 103 https://www.smashingmagazine.com/wp-content/uploads/2016/09/American-Illustration-33-big-opt.jpg
  104. 104 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Procesni-Mehanize-big-opt.jpg
  105. 105 https://www.behance.net/gallery/41466863/Various-illustrations-2016
  106. 106 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Procesni-Mehanize-big-opt.jpg
  107. 107 https://www.smashingmagazine.com/wp-content/uploads/2016/09/blossom-big-opt.jpg
  108. 108 https://unsplash.com/photos/O85h02qZ24w
  109. 109 https://www.smashingmagazine.com/wp-content/uploads/2016/09/blossom-big-opt.jpg
  110. 110 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Focus-Magazine-Illustration-big-opt.jpg
  111. 111 https://www.behance.net/gallery/41407903/Focus-Magazine-illustrations
  112. 112 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Focus-Magazine-Illustration-big-opt.jpg
  113. 113 https://www.smashingmagazine.com/wp-content/uploads/2016/09/The-joy-of-new-roads-big-opt.jpg
  114. 114 https://unsplash.com/new?photo=VfUN94cUy4o
  115. 115 https://www.smashingmagazine.com/wp-content/uploads/2016/09/The-joy-of-new-roads-big-opt.jpg
  116. 116 https://www.smashingmagazine.com/wp-content/uploads/2016/09/city-guide-paris-london-berlin-big-opt.jpg
  117. 117 http://www.maitefranchi.com/index.html
  118. 118 https://www.smashingmagazine.com/wp-content/uploads/2016/09/city-guide-paris-london-berlin-big-opt.jpg
  119. 119 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Velorama-Lightyear-big-opt.jpg
  120. 120 http://silencetv.com/work.html
  121. 121 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Velorama-Lightyear-big-opt.jpg
  122. 122 https://www.smashingmagazine.com/wp-content/uploads/2016/09/the-Brickmasters-big-opt.jpg
  123. 123 http://www.raulsoria.de/#/els-amos-ocults-del-totxo/
  124. 124 https://www.smashingmagazine.com/wp-content/uploads/2016/09/the-Brickmasters-big-opt.jpg
  125. 125 https://www.smashingmagazine.com/wp-content/uploads/2016/09/bison-big-opt.jpg
  126. 126 https://dribbble.com/shots/2899113-Bison
  127. 127 https://www.smashingmagazine.com/wp-content/uploads/2016/09/bison-big-opt.jpg
  128. 128 https://www.smashingmagazine.com/wp-content/uploads/2016/09/No-Mans-Sky-big-opt.jpg
  129. 129 https://dribbble.com/shots/2894892-No-Man-s-Sky
  130. 130 https://www.smashingmagazine.com/wp-content/uploads/2016/09/No-Mans-Sky-big-opt.jpg
  131. 131 https://www.smashingmagazine.com/wp-content/uploads/2016/09/FiveThirtyEight-Election-big-opt.jpg
  132. 132 https://dribbble.com/shots/2905222-FiveThirtyEight-Election
  133. 133 https://www.smashingmagazine.com/wp-content/uploads/2016/09/FiveThirtyEight-Election-big-opt.jpg
  134. 134 https://www.smashingmagazine.com/wp-content/uploads/2016/09/The-Secret-To-Sleep-big-opt.jpg
  135. 135 https://dribbble.com/shots/2924242-The-Secret-To-Sleep
  136. 136 https://www.smashingmagazine.com/wp-content/uploads/2016/09/The-Secret-To-Sleep-big-opt.jpg
  137. 137 https://www.smashingmagazine.com/wp-content/uploads/2016/09/geoengineering-big-opt.jpg
  138. 138 http://www.raulsoria.de/#/om-de-opwarming-te-stoppen-moeten-we-het-klimaat-leren-manipuleren/
  139. 139 https://www.smashingmagazine.com/wp-content/uploads/2016/09/geoengineering-big-opt.jpg
  140. 140 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Bicycle-Adventure-Meeting-big-opt.jpg
  141. 141 http://www.fabioconsoli.com/bam-bike-adventure-meeting/
  142. 142 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Bicycle-Adventure-Meeting-big-opt.jpg
  143. 143 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Brooklyn-Bridge-big-opt.jpg
  144. 144 https://unsplash.com/?photo=-sQ4FsomXEs
  145. 145 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Brooklyn-Bridge-big-opt.jpg
  146. 146 https://www.smashingmagazine.com/wp-content/uploads/2016/09/shop-magazine-czech-republic-big-opt.jpg
  147. 147 https://www.behance.net/gallery/31551067/Mait-Franchi-SHOP-magazine-Czech-Republic
  148. 148 https://www.smashingmagazine.com/wp-content/uploads/2016/09/shop-magazine-czech-republic-big-opt.jpg
  149. 149 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Bicycling-Magazine-douglas-big-opt.jpg
  150. 150 http://www.douglasjones.com/134442/1336565/gallery/bicycling-magazine
  151. 151 https://www.smashingmagazine.com/wp-content/uploads/2016/09/Bicycling-Magazine-douglas-big-opt.jpg
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to topTweet itShare on Facebook

Advertisement

Redesigning SGS’ Seven-Level Navigation System: A Case Study

Redesigning SGS’ Seven-Level Navigation System: A Case Study

SGS (formerly Société Générale de Surveillance) is a global service organization and provider of inspection, verification, testing and certification services across 14 industries. SGS’ website (along with 60 localized websites) primarily promotes the organization’s core services, as well as provides access to a multitude of useful services, supplementary content and tools. Our goal was to transform sgs.com1 from being desktop-only to being responsive.

This presented a unique set of challenges, especially around the legacy navigation system, which in areas was up to seven levels deep (divided into two parts) and which consisted of some 12,000 individual navigable items.

Our natural reaction upon seeing and using SGS’ navigation system for the first time was that surely the information architecture (IA) had to be simplified because of the sheer volume of navigable links and content. However, considering the navigation had already been optimized for search engines and the IA prior to this project and considering that SGS offers a wide selection of services across many industries (reflected in the volume of content), it was evident that refactoring the IA would not be a part of the solution.

2
Previous navigation solution on sgs.com (View large version3)

Simply put, the navigation tree’s structure had to remain intact. Even so, that didn’t prevent us from making some minor adjustments to the IA. For instance, “News, Media & Resources” and “SGS Offices & Labs” were moved to the top level, for greater visibility. With the former, it was important to more clearly reflect that SGS regularly publishes news and hosts events. With the latter, it was vital that it, along with the contact page, were easily reachable from anywhere in the website’s structure. Therefore, the key question was how could such a behemoth of a navigation system be made to easily transition between different viewports while still being usable?

Establishing Project Policies Link

A healthy client-designer relationship4 is essential to the success of every project. Setting clear expectations as well as providing effective guidance ensures not only that key stakeholders remain focused throughout, but also that trust develops between all parties as the project progresses. This was definitely the case with this project; the collaboration between all parties and the mutual appreciation of each other’s roles and expertise were truly remarkable.

However, to ensure that all parties remained focused, we established at the kick-off meeting a number of important guidelines and requirements within which we could also exercise creativity (some of which we insisted on, others insisted on by the client):

  • Content parity

    Content should be accessible on every device and platform and under no circumstances should be hidden on mobile.
  • Performance

    The website should perform at least 20% faster than competing websites. This was particularly useful when deciding how much information should go on each page.
  • Accessibility

    The website must adhere to WCAG 2.0 level-AA accessibility guidelines. We succeeded in achieving this target, aside from a borderline color-contrast issue, due to the company’s branding.
  • Usability

    The in-house team had to extensively validate concepts and conduct in-person and remote usability testing.
  • Uninterrupted business

    The redesign shouldn’t disrupt the company’s business at all. Clearly, the task was not to optimize the company’s services, but rather to optimize the website, taking into account established business processes. For instance, we had the freedom to optimize web forms, but the structure of the data in the CRM had to remain intact.

The Three Major Challenges Link

With key guidelines established and knowing the navigation’s redesign wouldn’t require a significant overhaul of the IA, we subdivided the redesign into three key yet interdependent sets of activities:

  • Layout placement

    This was handled mostly by the in-house team, with us suggesting improvements and making sure any decisions wouldn’t have radical implications for other aspects of the new responsive design.
  • Interaction and usability

    These were worked on collaboratively with SGS’ design team. Ideas were exchanged via email and in on-site workshops and were regularly validated against users, stakeholders and the overall business requirements.
  • Performance

    This was dealt with solely by us, because it was more of a technical challenge and didn’t require any strategic decision-making other than for us to make the new responsive website fast.

Layout Placement Link

Navigation is a fundamental element of page layout, regardless of the size or complexity of the website. While an off-screen pattern might seem appealing when you’re dealing with such a large-scale navigation system, remember that there can be issues5 when the navigation is not visible to the user.

SGS’ design team had initially tested a variety of concepts, because they had to not just evaluate the navigation interaction, but also create the right balance with the rest of the page and avoid clutter.

A few early, later discarded, concepts of the navigation placed in the layout6
A few early (later discarded) concepts of the navigation placed in the layout (View large version7)

Deciding on the Concept Link

Given the complexity of the website, it was vital that the navigation always remain visible and inform the user where they are within the tree structure. Rather than divide the navigation into two parts in the UI, we wanted the new navigation system to be seamless (from the top level right through to the bottom levels). Therefore, it had to enable the user to easily browse up and down the navigation tree, as well as sideways across the main sections.

To test and validate all of these combinations, we developed a prototype for each of the eight initial navigation concepts. The prototypes confirmed what the in-house team already suspected: The most viable option in terms of usability, maintenance, cross-screen experience, visual clutter and appeal was for the navigation to be placed in the sidebar on large screens and to appear as a dropdown menu on small screens. Essentially, the navigation module would be functionally and visually self-contained, regardless of screen size.

The new navigation module would be visually and interactively identical across different viewpoints, enabling us to approach the design and development mobile-first.8
The new navigation module would be visually and interactively identical across different viewpoints, enabling us to approach the design and development mobile-first. (View large version9)

While we will focus on specific interaction decisions in a minute, it’s worth pointing out that interactive prototypes don’t necessarily have to be discarded once a prototyped concept has been tested and validated.

Prototyping Smart Link

We always develop prototypes directly in HTML, CSS and JavaScript using semantic, accessible and robust markup, because we are then often able to reuse the initial prototypes later in the design process. This meant that our initial prototype for the new navigation system became the cornerstone for the eventual full website prototype, which included all of the page templates and modules.

In delivering the full prototype, we also ensured the style guide was generated automatically for the SGS team. By getting SGS’ design team to think in terms of designing and developing modules, rather than complete pages, the generated style guide would require little ongoing maintenance. The style guide itself refers to all of the distinctive modules used, with each module containing a precise description, code example and automatically generated link to the page template where it is used. Our technology of choice for automating tasks and features is PHP, but automation can be achieved using any server-side language, as long as the output is semantic HTML. (We developed a specific file-system framework for our prototypes, but that’s a topic for another occasion.) Later on in this article, we will explain how server-side scripting helped us to maintain and test multiple versions of the navigation.

Even though starting with semantic, accessible and robust HTML is vital, the principle of “content-first, navigation-second” is just as important because it helps you to account for any possible future exceptions. There was one exception to the “content-first, navigation-second” rule in this project: the home page. We discovered, based on analytics, that the navigation was viewed as the most important element on the home page, which meant it had to come before any core content on the page.

Interaction And Usability Link

Once the decision was made to design and develop a self-contained, screen-size-agnostic navigation module, it was time to focus on navigation interactions. Considering that we had adopted a mobile-first approach to designing the navigation, the navigation module itself not only would naturally function as expected in small viewports, but would easily scale to work in large viewports, too.

Three Interactive Versions Link

Due to the size of the navigation and the potential number of nested levels, we had to eliminate some of the more common mobile navigation patterns10 as options — for instance, select dropdowns and the priority+ pattern. We focused on prototyping three interactive versions of the navigation: a slider, an accordion, and an accordion and slider. Each has its pros and cons, which naturally influenced our decision.

Accordion

The accordion is probably the most common pattern on mobile. It discloses progressively, revealing more detailed information as the user progresses through the topic or action. It also ensures the user does not get overwhelmed, which is why we wanted to use it as a baseline solution.

Here are the accordion’s pros:

  • Users are familiar with it.
  • Users can expand the entire navigation tree to preview multiple options (seven levels of navigation can be a little overwhelming, after all).
  • It works without JavaScript, using the :target pseudo-class11.
  • Developing it is easy.

And the accordion’s cons:

  • The expanded ancestors of a deep-level category would push the current scope too far away from the top of the screen, thus requiring a lot of scrolling.
  • Seven levels of navigation requires seven degrees of the chosen visual cue, whether it be seven shades of a basic color (gray), seven levels of typographic hierarchy or seven levels of indentation.

Slider

This was initially our favorite solution, but it misses one important element: allowing truly sideways browsing across the main sections. It wouldn’t be such a problem if the user always starts browsing from the home page, because they would become increasingly familiar with the main sections. However, for users who land on a page deep in the navigation tree, it definitely would have been a usability problem. For instance, users who land on the third, fourth or fifth level would have to traverse up the tree in order to reach the contact page. Traversing seven levels is no fun, no matter how motivated the user might be.

Slider pros:

  • The hierarchy is clear.
  • The animation is slick.
  • It follows mobile conventions.
  • It is relatively easy to develop.

Slider cons:

  • Browsing sideways is not possible.
  • The animation is not performant.

Hybrid (accordion and slider)

We really wanted to maintain the attractiveness of the slider, while still allowing sideways browsing. Therefore, we developed of a hybrid solution combining the best elements of the two navigation patterns. Incidentally, it was also the solution we settled on.

The hybrid approach brought the best of both worlds.12
The hybrid approach brought the best of both worlds (View large version13)

Hybrid pros:

  • Sideways browsing is possible.
  • The animation is slick.
  • The hierarchy is clear.

Hybrid cons:

  • It requires some initial learning.
  • It is complex to develop, with many moving parts to consider.
  • It has some performance issues.

As mentioned, the user should be able to browse up and down the navigation tree, always aware of where they have come from and where the navigation will take them next. However, that’s just the baseline interaction — we had to address quite a few additional issues in order to develop a usable navigation system.

Eight Distinctive Types of Links Link

Apart from current and ancestor navigation items being distinct in design (which is now, thankfully, a well-established practice), we further improved the navigation and general usability by helping the user to understand where they are and what they’re exploring. Helping the user to understand the current page and its parents, as well as any relevant children relationships, was far from enough. Other important actions were required:

  • being able to go directly to the parent page;
  • being able to preview both parent and children levels, all while staying at the original URL;
  • quickly understanding their current browsing position, while being able to explore the navigation.
  • quickly understanding their current position on the page.

Note: We used breadcrumbs to ensure that the current page position is always clear to the user. Because we wanted to avoid skipping levels altogether, the information in the breadcrumbs and the navigation had to match one to one, even with pseudo-levels (i.e. levels that don’t have an actual page).

The user requirements above resulted in five types of semantically different navigation items, with additional helper links that would allow the user to traverse up and down the tree without having to leave the current page. You can imagine the complexity and interdependencies that come with so many moving parts.

Each of the eight distinctive types of links in the navigation required their own unique combinations of class names, visual identity as well as interactive set of rules14
Each of the eight distinctive types of links in the navigation required its own unique class name, visual identity and interactive set of rules. (View large version15)

Animation Details Link

All elements in the navigation are animated using CSS, with each animation having two distinct parts:

  • horizontally animated levels,
  • vertically animated wrappers.

First, the different tree levels in the slider are toggled by changing the class of the master wrapper. For example, the closed navigation wrapper has a class of .depth-0. When a top-level item is expanded, the class changes to .depth-1. When a second-level item from within that top-level item is selected, the class changes to .depth-2, and so on. This results in a fairly simple set of CSS rules that get applied to a single element — the topmost-ordered list in a slider:

.depth-1 .l-0.nav-open > ol { left: 0; } .depth-2 .l-0.nav-open > ol { left: -100%; } .depth-3 .l-0.nav-open > ol { left: -200%; } 

In the example above, .l-0 corresponds to a zero-level list item, and .nav-open is toggled whenever the accordion is set to open. This means that the ordered list of a direct child in an open accordion list item is absolutely offset to the negative-left position.

Secondly, considering that each level contains a variable number of list items, the transition between any two adjacent levels has to be smooth.

16
Showcasing the default and improved transition

To achieve this, we made sure there is always sufficient vertical room for the horizontal animation to run smoothly. The height is calculated and applied on the fly by retrieving the vertical offset of the element about to enter the screen. This means we had to account for a total of four possible scenarios, but really only needed to resolve two, each with a slightly different order of execution:

  • Short list item to a longer list item

    The horizontal and vertical animation start at the same time.
  • Long list item to a shorter list item

    After the navigation stops sliding horizontally, the vertical animation starts.

Both animations are initiated at the same time, but the second animation gets initiated after a 300-millisecond delay, which is exactly the duration of the first animation (specified in CSS using the transition-duration property). The reason for this is suboptimal animation performance on less-capable devices when multiple layers overlap before disappearing “behind the curtain.” The simplified code looks like this:

if (newHeight < oldHeight) { heightTimeout = 300; } else { heightTimeout = 0; } setTimeout(function() { $('.l-0.nav-open').css('height', newHeight); }, heightTimeout); 

Further Improvements Link

Already faced with a complex set of interdependencies, we realized upon testing the navigation that there was room for improvement.

First, because web fonts sometimes load a little later than the rest of the page, some strings of text in the navigation that are meant to be on one line would expand to a second line before the web font had fully loaded. For instance, the top-level section link “News, Media and Resources” falls onto two rows when rendered in the fallback font.

The navigation rendered in the fallback font17
The navigation rendered in the fallback font (View large version18)

Because everything had to be really compact (since we had to use absolute positioning for the sliding animation), the only solution was to reset the height of the affected element after the web font had loaded. This was done using Web Font Loader19, developed by Bram Stein20 for Adobe Typekit21 and Google Fonts22.

WebFont.load({ custom: { families: ['FONT_NAME_1', 'FONT_NAME_2'] }, active: function() { // recalculate things here }, timeout: 5000 }); 

Note: Did you notice how we used a 5-second timeout? In our testing, we found this to be the sweet spot that made it work on our baseline “good 2G” (450 KB per second) connection!

Secondly, because we decided to conditionally load the navigation nodes in order to improve initial loading performance (more on that in the next section), we wanted the user to be kept aware of how many navigation items are available, in case there is a delay in loading a branch of the navigation tree. We did this by repeating a placeholder background image that resembles a string of text23.

Placeholders are loaded that visually resemble the list of links.24
Placeholders are loaded that visually resemble the list of links. (View large version25)

Finally, we appended the placeholder code in the DOM with JavaScript before requesting the navigation branch. This keeps the DOM as clean as possible.

 element.append('<ol><li></li></ol>'); $.get('NAVIGATION_BRANCH_URL', function(data){ // replace the loader with the branch element.find('ol').replaceWith(data); }); 

Performance Link

If you recall, one of our key targets in the project was for the website to perform at least 20% better than competitors’ websites. Not only did we achieve this target, but in doing so we helped SGS to significantly reduce overall page weight and loading times. Take a look at the following before-and-after statistics:

HTTP requests File size: total File size: HTML
Original SGS home page 40 1,500 KB 72 KB
Original SGS industry page 60 2,200 KB 50 KB
New responsive home page 17 960 KB 42 KB
New responsive industry page 20 680 KB 40 KB

Did You Know That 12,000 Links Equals 3 MB of HTML? Link

That’s correct! When we rendered the full navigation tree for the first time in our prototype, it amounted to 3 MB of bare HTML. No header, no footer and no content — just the navigation tree consisting of 12,000 individual links.

Prior to the redesign, every page contained the core navigation tree, and each industry page also included an industry-specific navigation tree, implemented as a separate module. However, the desktop-optimized design made the core or industry-specific navigation not only difficult to use on small viewports, but difficult to maintain, too. That’s why one of the key goals of the redesign was to consolidate the tree into a single and easy-to-maintain module.

Exploring Options to Improve Performance Link

To thoroughly test each of the three interactive versions of the navigation, as well as evaluate their performance, a flexible testing environment was essential. This would enable us to make changes quickly, as well as to maintain concurrent versions so that we could easily compare them against each other.

Considering the size of the complete navigation tree (up to seven levels deep and 12,000 navigable links), being able to test parts of the navigation tree as well as the full tree itself was important. SGS’ in-house developers were able to export the full navigation tree as a CSV file from their content management system, which allowed us to create an easily configurable PHP function to output either the full tree or part of it, depending on what we needed to test.

Our PHP function also simplified the HTML maintenance of the navigation tree’s structure, because the aforementioned link markup and class names could be easily changed in a single place. Using a server-side language to avoid having to repeat code might sound obvious, but creating this type of environment was not just a welcome addition, but was actually mission critical, because it was the prerequisite to agile experimentation and testing.

Conditionally Loading Links Link

We mentioned that we had to conditionally load the navigation nodes to improve initial loading performance. The question that then needed answering was, How much of the navigation tree should be loaded initially and how much should be loaded later, and when? After testing and comparing the weights and sizes of the different navigation tree branches, as well as studying user behavior on the existing live website, a few interesting conclusions emerged.

First, visitors who were interested in only one type of industry rarely visited other industries. Once browsing their selected industry category, each visitor would typically go on to explore just a couple of other pages.

Secondly (and as we had initially thought), the industry-specific branches caused the majority of performance overhead. When we removed the industry branches altogether, the HTML was reduced to 70 KB, which is a lot better than 3 MB! Still, it meant that each of the 14 industry branches weighed between 300 and 500 KB. When we fragmented each service branch further, we found that each subsequent level would weigh around 24 KB on average.

While we were aware that the HTML could be further reduced by optimizing the class names and adding DOM nodes via JavaScript (more on that in a minute), we still had to determine whether it was best to initiate a single HTTP request at around 300 to 500 KB or to initiate an HTTP request of around 24 KB at each level. Initially, it seemed that sending a 24 KB request each time the user progressed further down the navigation tree would be more beneficial. However, this would have resulted in multiple HTTP requests being sent over the network, which was far from ideal, considering that network latency is often one of the biggest bottlenecks for website performance. It also didn’t make sense to predict the loading of any industry branches either, except when the user showed intent by hovering over an industry link.

Due to the complexity of the navigation and the quantity of links, the following arrangement offered by far the best compromise:

  • Load the first three levels by default in HTML.
  • Load the industry navigation with JavaScript when intent is shown, detected using the mouseover event.
  • Cache loaded branches to speed up loading on consecutive page loads.

The logic for deeper pages was somewhat different, because the navigation needs to be accessible without JavaScript enabled. Therefore, if a user (or even a search engine bot) lands on a deep page, the following would happen:

  1. Render the first three levels and the current page’s ancestor branch and page siblings in HTML, thereby allowing the user to easily access the parent, ancestor and sibling pages, while also being able to access other parts of the website following the same logic.
  2. Load the current branch with JavaScript, and replace the initially loaded current page’s ancestor branch.

Optimizing HTML Link

If you truly want to optimize your HTML, all non-essential items have to be offloaded to CSS and JavaScript. We rigorously pruned everything except the ordered list, its list items and their respective links. All non-essential links (i.e. navigation aids) were also removed from the HTML and are reinserted back in the DOM using JavaScript (because they are ineffective without JavaScript anyway). These non-essential links enable the user to do a couple of things:

  • open the next level (internally, we called these “expanders”);
  • go up a level (we named these “backers” — showing a lack of imagination).

While the resulting DOM was still immense, the navigation aids no longer needed to be transferred individually over the network.

Finally, the last piece of optimization we undertook was to reduce the number of classes, as well as to shorten the length of class names; for example, .very-long-class-name became .v-l-c-n. While the latter yielded the biggest gains, such optimization is difficult to justify because it usually doesn’t significantly trim the size of the HTML file, and, more importantly, it reduces the clarity of the code, thus possibly making maintenance more difficult. However, shaving off even a single byte from each of the 12,000 list items made it a worthwhile exercise and an acceptable trade-off.

The result? A whooping 40 KB or so of initial HTML (8 to 9 KB when compressed and transferred over the network), and 200 to 300 KB of HTML for each industry (15 to 25 KB when compressed and transferred).

Conclusion: Marginal Gains Matter Link

We like to use an analogy from the sports world: Improving every tiny thing by 1% dramatically improves performance26. This applies to what we did in the SGS project and its intricate navigation. By focusing on the finer details, improving each detail by a tiny bit, we significantly reduced the complexity of the navigation and improved loading times, while keeping the navigation appealing and engaging for users. What could have been a nightmare and a tough nut to crack turned into a technically and interactively relevant solution, flexible enough to accommodate further improvement.

Most of all, the design process of continually prototyping, investigating options and refining the best solutions proved to be extremely effective — so much so that it has provided a strong case for the in-house team to apply the same fundamental principles when developing other products in the organization, not to mention that it will help the team to continue refining and optimizing the new navigation system. No web project is ever truly complete; there are always a few more things on the to-do list. That’s perfectly fine, as long as we keep on testing, refining and providing the best experience for users.

(vf, il, yk, al)

Footnotes Link

  1. 1 http://www.sgs.com/
  2. 2 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-previous-navigation-solution-opt.jpg
  3. 3 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-previous-navigation-solution-opt.jpg
  4. 4 https://www.smashingmagazine.com/2016/06/client-experience-design/
  5. 5 http://thenextweb.com/dd/2014/04/08/ux-designers-side-drawer-navigation-costing-half-user-engagement/#gref
  6. 6 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-early-concepts-opt.jpg
  7. 7 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-early-concepts-opt.jpg
  8. 8 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-current-navigation-in-layout-opt.jpg
  9. 9 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-current-navigation-in-layout-opt.jpg
  10. 10 http://bradfrost.com/blog/web/complex-navigation-patterns-for-responsive-design/
  11. 11 http://www.creativebloq.com/css3/build-smart-mobile-navigation-without-hacks-6122800
  12. 12 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-accordion-slider-opt.jpg
  13. 13 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-accordion-slider-opt.jpg
  14. 14 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-eight-types-of-links.gif
  15. 15 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-eight-types-of-links.gif
  16. 16 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-transition-default.gif
  17. 17 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-string-second-row-opt.jpg
  18. 18 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-string-second-row-opt.jpg
  19. 19 https://github.com/typekit/webfontloader
  20. 20 https://github.com/bramstein
  21. 21 https://www.typekit.com
  22. 22 https://fonts.google.com
  23. 23 https://material.google.com/patterns/empty-states.html
  24. 24 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-loading-placeholder-opt.jpg
  25. 25 https://www.smashingmagazine.com/wp-content/uploads/2016/08/sgs-loading-placeholder-opt.jpg
  26. 26 http://jamesclear.com/marginal-gains
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to topTweet itShare on Facebook

Advertisement

The Building Blocks Of Progressive Web Apps

The Building Blocks Of Progressive Web Apps

The common wisdom for most companies that set out to build an app is to build a native Android or iOS app, as well as a supporting website. Although there are some good reasons for that, not enough people know about the major advantages of web apps. Web apps can replace all of the functions of native apps and websites at once. They are coming more and more to the fore these days, but still not enough people are familiar with them or adopting them.

Further Reading on SmashingMag: Link

Here, you will be able to find some do’s and dont’s on how to make a progressive web app, as well as resources for further research. I’ll also go into the various components and support issues surrounding web apps. Although not every browser is friendly to them, there are still some compelling reasons to learn more about this technology.

What Makes A Web App Progressive? Link

A progressive web app is an umbrella term for certain technologies that go together to produce an app-like experience on the web. For simplicity’s sake, I’ll refer to them simply as web apps from now on.

An ideal web app is a web page that has the best aspects of both the web and native apps. It should be fast and quick to interact with, fit the device’s viewport, remain usable offline and be able to have an icon on the home screen.

At the same time, it must not sacrifice the things that make the web great, such as the ability to link deep into the app and to use URLs to enable sharing of content. Like the web, it should work well across platforms and not focus solely on mobile. It should behave just as well on a desktop computer as in other form factors, lest we risk having another era of unresponsive m.example.com websites.

Progressive web apps are not new. Mobile browsers have had the ability to bookmark a website to your phone’s home screen since 2011 (2013 on Chrome Android), with meta tags in the head determining the appearance of the installed web page. The Financial Times has been using a web app4 for digital content delivery on mobile devices since 2012.

Moving to a web app enabled the Financial Times to use the same app to ship across platforms in a single distribution channel. Back when I was working for the Financial Times, with a single build we were able to support the following:

  • iOS,
  • Android (4.4+) Chrome,
  • older Android (via a wrapper),
  • Windows 8,
  • BlackBerry,
  • Firefox OS.

That truly achieves “build once, deploy anywhere.”

“But It’s Not In An App Store” Link

There are some good reasons why supplementing a native app with a website is still standard practice for most major companies. Among them are concerns about browser support and the fact that most users are acclimated to using native apps. I will address these issues in more detail later. Not least of these concerns is how the app will get exposure if it is not in an app store.

5
As popularity decreases, exposure in the store decreases exponentially. (Image: Charles Perry6) (View large version7)

I would argue that being in an app store has no major advantage because it has been shown that if you are not in the top 0.1% of apps in the app store, you are not getting significant benefit from being there.

Users tend to find your apps by first finding your website. If your website is a web app, then they are already at their destination.

One of the strengths of a web app is that it enables you to improve engagement by reducing the number of clicks required to re-engage the user between landing on your website and engaging with your app.

By having the user “install” your web app by adding it to their home screen, they can continue engaging with your website. When they close down the web browser, the phone will show them where the web app is installed, bringing you back to their awareness.


Video of a web app being added to the home screen. When the browser is minimized, the icon is animated as it gets added. When the web app is loaded up again, the URL bar is hidden.

Background And Current Climate Link

Modern web apps are based on a new technology called service workers. Service workers are programmable proxies that sit between the user’s tab and the wider Internet. They intercept and rewrite or fabricate network requests to allow very granular caching and offline support.

Since the origins of the web app in 2011, which enabled websites to be bookmarked to the home screen, a number of developments have taken place to lay more groundwork for the creation of progressive web apps.

Chrome 38 introduced the web app manifest, which is a JSON file that describes the configuration of your web app. This allowed us to remove the configuration from the head.

In Chrome 40 (December 2014), service workers started to roll out across Firefox and Chrome. Apple has so far chosen not to implement this feature in Safari as of the time of writing but has it “under consideration8.” The service worker’s function is to simplify the process of bringing an app offline; it also lays the foundation for future app-like features, such as push notifications and background sync.

Apps that were built based on the new service workers and the web app manifest became known as progressive web apps.

A progressive web app is not the same as the spec. In fact, it started out as a definition of what a web app should be in the era of service workers, given the new technology being built into browsers. Specifically, Chrome uses this definition to trigger an install prompt in the browser when a number of conditions are met. The conditions are that the web app:

  • has a service worker (requires HTTPS);
  • has a web app manifest file (with at least minimal configuration and with display: "standalone");
  • has had two distinct visits.

In this case, “progressive” means that the more features the browser supports, the more app-like the experience can be.

The prompt to install the web app is currently shown under varying conditions across Opera, Chrome and the Samsung browser.

Apple has indicated interest in progressive web apps for iOS, but at the time of writing it still relies on meta tags for web app configuration and the application cache (AppCache) for offline use.

At What Point Does A Website Become A Web App? Link

We know what a website looks like and what an app looks like, but at what point does a website become a web app? There is no definitive metric as to what makes something a web app rather than a website.

Here we will go into some more detail about the characteristics of a web app.

A Progressive Web App Should Exhibit Certain App-Like Properties… Link

  • Responsive

    Perfectly filling the screen, these websites are primarily aimed at phones and tablets and must respond to the plethora of screen sizes. They should also just work as desktop websites. Responsive design has been a major part of website building for many years now. Smashing Magazine has some great articles9 on it.
  • Offline-first

    The app must be capable of starting offline and still display useful information.
  • Touch-capable

    The interface should be designed for touch, with gesture interaction. User interaction must feel responsive and snappy, with no delay between a touch and a response.
  • App meta data

    The app should provide meta data to tell the browser how it should look when installed, so that you get a nice high-resolution icon on the home screen and a splash screen on some platforms.
  • Push notifications

    The app is able to receive notifications when the app is not running (if applicable).

… But Should Maintain Certain Web-Like Properties Link

  • Progressive

    The app’s ability to be installed is a progressive enhancement. It is vital that the app still work as a normal website, especially on platforms that do not yet support installation or service workers.
  • HTTPS on the open web

    The app should not be locked to any browser or app store. It should be able to be deep linked to and should provide methods for sharing the current URL.

Taking Your Website Offline Link

Taking your website offline brings some major advantages.

First, it will still work when the user is on a flaky network connection.

In addition, the time from opening the app to using the app is greatly reduced if the app does not rely on the network. This gives the user a great experience. A carefully optimized web app can start faster than a native one if the browser has been used recently.

There are two methods to getting a website to work offline:

  • Old and busted method

    Support for starting your website offline has been around for years in the form of AppCache. AppCache has some serious flaws, though, and has even been deprecated from the specification10. It is difficult to work with and, if misconfigured, could permanently break your website. Still, it is the only way to do offline on iOS, at least until Apple makes a move to support service workers.
  • New hotness

    Also effective are service workers, which are currently supported in Chrome, Firefox and Opera and coming very soon to Edge. Apple’s WebKit team has it marked “under consideration.”

Service workers are like other web workers in that they run in a separate thread, but they are not tied to any specific tab. They are assigned a URL scope when they are created, and they can intercept and rewrite any requests in this scope. If your service worker sits at http://example.com/my-site/sw.js, it will be able to intercept any requests made to /my-site/ or lower but cannot be made to intercept requests to the root http://example.com/.

Because they are not tied to any tab, they can be brought to life in the background to handle push notifications or background sync. Not least, it is impossible to permanently break your website with them because they will automatically update when a new service worker script is detected.

A good guideline is that, if you are building a new website from scratch, start off with a service worker. However, if your website already works offline with AppCache, then you can use the tool sw-appcache-behavior11 to generate a service worker from this, because we may soon reach the point when some browsers will only accept service workers and some will only accept AppCache.

Because AppCache is being deprecated, I will not discuss it further in this article.

Setting Up A Service Worker Link

(Also, see “Setting Up a Service Worker12” for more detailed instructions.)

Because a service worker is a special type of shared web worker, it runs in a separate thread to your main page. This means that it is shared by all web pages on the same path as the service worker. For example, a service worker located at /my-page/sw.js would be able to affect /my-page/index.html and my-page/images/header.jpg, but not /index.html.

Service workers are able to intercept and rewrite or spoof all network requests made on the page, including those made to data:// URLs!

This power enables it to provide cached responses to get pages to work when there is no data connection. Still, it is flexible enough to allow for many possible use cases.

It is only allowed in secure contexts13 (i.e. HTTPS) because it is so powerful. This prevents third parties from permanently overriding your website using an injected service worker from an infected or malicious Wi-Fi access point.

Setting up HTTPS nowadays might seem daunting and expensive, but actually it has never been easier or cheaper. Let’s Encrypt14 provides free SSL certificates and scripts for you to automatically configure your server. In case you host on GitHub, GitHub Pages are automatically served over HTTPS. Tumblr pages can be configured to run on HTTPS, too. CloudFlare can proxy requests to upgrade to HTTPS.

Offlining usually involves picking certain caching methods for different parts of your website to allow them to be served faster or when there is no Internet connection. I will discuss various caching methods below.

I use Service Worker Toolbox2915 to abstract away complex caching logic. This library can be set to handle the routing by providing four preconfigured routes, which can be configured in a clean fashion. It can be imported into your service worker.

Use Case 1: Precaching Link

Precaching pulls down requests before your website works out that they are needed. This can greatly decrease first paint time because your website doesn’t need to parse /site.css before it starts downloading your website’s logo, /images/logo.png.

toolbox.precache(['/index.html', '/site.css', '/images/logo.png']); 

Use Case 2: Offline Link

Allowing users to revisit your website when they are offline in the simplest case means falling back to the cache if the device is offline. Setting a timeout here is important because a flaky network, misconfigured router or captive portal could leave the user waiting indefinitely.

toolbox.router.default = toolbox.networkFirst; toolbox.options.networkTimeoutSeconds = 5; 

In reality, we can actually be a little smarter because the majority of your assets will not change over time. We probably just want to get the content as soon as possible, whether from the cache or the network. The following line tells Service Worker Toolbox that all requests to the images’ paths should come from the cache if they are available there.

toolbox.router.all('/images/*', toolbox.fastest); 

In this case, when the user is authenticating, it is important that we not just return a cached response; we should state that requests made to /auth/ should be network-only.

toolbox.router.post('/auth/*', toolbox.networkOnly); 

Here are some good practices for offlining:

  • Initial static assets should be precached. This downloads them and caches them when the service worker is installed. This means that they do not need to be loaded from the server when they are eventually required.
  • By default, requests should ideally be freshly sourced from the network but fall back to the cache so that they are available offline.
  • A relatively short network timeout means that requests will be able to return cached data on a network connection that says it has a data connection but no responses are being returned.
  • Infrequently updated assets, such as images, should be dispatched from the cache first, then the browser would also try to update them. If toolbox.cacheOnly is used, then it could also save the user’s data.

Note: The browser cache and the Cache API are different animals. The Cache API has been bypassed in the case of network-first or network-only. The request might still hit the browser’s cache because the caching headers in the request say it is still valid. This could result in the problem of the user receiving a mixture of cached and fresh data. Jake Archibald has some good suggestions for avoiding this issue16.

Debugging Your Service Worker Link

If you are in Chrome or Opera, go to chrome://serviceworker-internals. This will allow you to inspect and pause and uninstall your service worker script.

In recent versions of Chrome and Opera, you can get detailed views and debugging tools through the “Application” tab in the inspector.

The Application tab in Chrome Developer Tools17
The “Application” tab in Chrome Developer Tools (View large version18)

Interaction And Animation Performance Link

People have come to expect that the web does not have the smoothly animated interfaces that native apps do. However, the same standard is not acceptable for web apps. Web apps must animate smoothly, lest our users feel we are delivering a degraded, second-class experience. We have three goals to make it feel fast:

  • When the user does something, the app must also do something within 100 milliseconds; otherwise, the user will notice a lag. This counts for taps, clicks, drags and scrolls.
  • Each frame must render at a consistent 60 frames per second (16 milliseconds per frame). Even a few slow frames will be obvious.
  • It must be fast on a three-year-old budget phone running on a poor network, not only your shiny development machine.
  • It must start quickly. Long have we been focused on maintaining user engagement by getting our websites to be visible and usable in under 1 to 2 seconds. When it comes to web apps, start-up time is as important as ever. If all of an app’s content is cached and the browser is still in the device’s memory, a web app can start faster than a native app. One mistake made by native app and website developers alike is requiring networked content in order for the product to work.
  • The web app must be small to download and update: 10 MB from an app store don’t feel like much, but 10 uncached MB downloaded every time is very much impossible to manage for a lot of mobile users.

Off the bat, the most essential item is this, in the head of the document:

<meta name="viewport" content="width=device-width"> 

This line ensures that there is no 300-millisecond tap delay on phone browsers that are Chromium-based or Firefox, but it still allows the user to zoom in by pinching (great for accessibility).

Since iOS 8 came out, clicks are fast by default but might seem slow if the tap is fast, according to certain heuristics19. If this is an issue for you, I recommend using FastClick20 to remove the delay.

There is also the issue of animation performance. You’ll probably want a lot of pretty elements animating in and out, elements that can be dragged by the user, and other lovely interactions.

Web performance can be discussed in great detail and is a subject close to my heart, but I won’t go into much detail here. I will touch on what I do to ensure that my interactions and animations are crisp and smooth.

Dig around or ask around your friends or family for an old smartphone. I usually borrow my partner’s Nexus 4.

Plug the phone into your computer, and go to chrome://inspect/#devices. This will open an inspection window, which you can use to inspect the web pages running on the phone. You can use profiling and view the timeline to find sources of poor performance and then optimize them based on a real baseline device.

Animating certain CSS properties is one of the biggest causes of jittery animation, known as jank. CSS Triggers21 is a great resource for determining which properties can be safely animated without causing the browser to repaint or re-lay out the whole page.

If writing performant animations is a daunting task for you, many libraries out there will handle the job. A favorite of mine is GreenSock22, which can handle touch interactions very well, such as dragging items, and which can do very fancy animation and tweening.

Push Notifications Link

Push notifications are a great way to re-engage with users. By prompting the user, you bring your app to the forefront of their mind. They could finish off an unfinished transaction or receive alerts about relevant new content.

Make sure your push notifications are relevant to the user for events happening at that moment. Don’t waste their time on things that can be done later. What you are notifying them about should require their action (replying to someone or going to an event). Also, don’t push a notification if your web app is visible or in focus.

When interacted with, a notification should take the user to a page that works offline. Notifications can hang around unread; they might be interacted with when the user has no network connection. The user will get frustrated if your push notification refuses to work after they have tried to interact with it.

The very best experience for push notifications frees the user from having to open your web app at all! “You have a new message” is useless and as annoying as a clickbait headline. Display the message and the sender.

Action buttons in the notification can provide interaction prompts that do not necessarily open the browser (“Like this post,” “Reply with yes,” “Reply with no,” “Remind me later”). These serve the user on their terms, keeps them engaged and minimizes their investment of time.

If you spam the user with regular or irrelevant notifications, they might disable notifications for your app in the browser. After that, it will be almost impossible to re-engage them, and you won’t be able to easily prompt them for permission again!

To avoid this, make the route to your app’s “disable notification” button clear and easy. Once you have addressed any issues frustrating users, you can try to re-engage.

The Push Notification API requires a service worker. Because it is possible to receive push notifications when no browser tab is open, the service worker will handle the notification request in a background thread. It can perform async operations, such as making a fetch request to your API before displaying the notification to the user.

To create a push notification, make a request to an endpoint provided by the browser manufacturer. For Chromium-based browsers (Opera, Samsung and Chrome), this would is Firebase Cloud Messaging. These browsers also behave a little off-spec as well.

One can find the details of this by requesting push-notification permission:

serviceWorkerRegistration .pushManager .subscribe({ // Required parameter as receiving updates // but not displaying a message is not supported everywhere. userVisibleOnly: true }) .then(function(subscription) { return sendSubscriptionToServer(subscription); }) 

The subscription is an object that looks like this:

{ "endpoint": "http://example.com/some/uuid" } 

In the example above, the uuid uniquely identifies the browser currently being used.

Note: Chromium-based browsers behave a little differently. You’ll need a Firebase app ID, which needs to be entered in your web app’s manifest file (for example, "gcm_sender_id": "90157766285").

Also, the endpoint will not work in the format it is given. Your server needs to mangle it slightly to get it to work23. It needs to be a POST request, with your API key in the head and the uuid in the body.

When sending a push notification, it is possible to send data in the body of the push notification itself. This is complex and involves encrypting the contents in the API request. The web-push24 package for Node.js can handle this, but I don’t prefer it.

It is possible to perform async requests once the notification has been received, so I prefer to send a minimal notification, known as a “tickle,” to the client, and then the service worker will make a fetch request to my API to pull any recent updates.

Note: The service worker can be closed by the browser at any point. The event.waitUntil function in the push event tells the service worker not to close until the event is finished.

self.addEventListener('push', function(event) { event.waitUntil( // Makes API request, returns Promise getMessageDetails() .then(function (details) { self.registration.showNotification( details.title, { body: details.message, icon: '/my-app-logo-192x192.png' }) }) ); }); 

You can listen for a click or press interaction on the notification events, too. Use these to decide how to respond. You could open a new browser tab, focus an existing tab or make an API request. You can also choose whether to close the notification or keep it open. Use this functionality with actions on the notification to build great functionality into the notification itself. This will make for a great experience, because the user will not be required to open your app each time.

Don’t Ignore The Strengths Of The Web Link

The final and most important point is that, in our rush for an app-like experience, we should not forget to stay web-like in one very important aspect: URLs.

Installed web apps often hide the browser shell. There is no address bar for the user to share the current URL, and the user can’t save the current page for later.

URLs have a unique web advantage: You can get people to use your app by clicking, rather than by describing how to navigate it. All the same, it is very easy to forget to expose this to users. You could write the best app in the world, but if no one can share it, you will have done yourself a major disservice.

It comes down to this: Provide ways to share your app via either sharing buttons or a button to expose the URL.

What About Browsers That Do Not Support Progressive Web Apps? Link

Check out Is ServiceWorker ready?25 for the current status of support for service workers across browsers.

You may have noticed throughout all of this that I have mentioned Chrome, Firefox and Edge but left out Safari. Apple introduced web apps to the world and has shown interest in progressive web apps, but it still does not support service workers or the web app manifest. What can you do?

It is possible to make an offline website for Safari with AppCache, but doing so is both difficult and fraught with weird edge cases that can break the page or keep it permanently out of date after first load.

Instead, build a great web app experience. Your work will not have been wasted because the experience will still be great in Safari, which is a very good browser. When service workers do come to Safari, you will be ready to take advantage of them.

Finally, we can look forward to a lot of exciting developments in the world of web apps, with increasing support for the technologies behind them and new features coming to the web platform, such as the Web Bluetooth API for interacting with hardware, WebVR for virtual reality, and WebGL 2 for high-speed gaming. Now is a great time to explore the possibilities of web apps and to take part in shaping the future of the web.

Links Link

Other Writing on Progressive Web Apps Link

Links Referred to in Article Link

(vf, yk, il, al)

Editor’s Note:We kindly thank Christian Heilmann32 for his kind technical and editorial support — this article wouldn’t be possible without him.

Footnotes Link

  1. 1 https://www.smashingmagazine.com/2016/08/a-beginners-guide-to-progressive-web-apps/
  2. 2 https://www.smashingmagazine.com/2016/02/building-first-class-app-leverages-website-case-study/
  3. 3 https://www.smashingmagazine.com/2015/04/creating-web-app-in-foundation-for-apps/
  4. 4 https://app.ft.com/
  5. 5 https://www.smashingmagazine.com/wp-content/uploads/2016/08/graph-from-dazeend-opt.png
  6. 6 http://dazeend.org/2015/01/the-shape-of-the-app-store/
  7. 7 https://www.smashingmagazine.com/wp-content/uploads/2016/08/graph-from-dazeend-opt.png
  8. 8 https://webkit.org/status/
  9. 9 https://www.smashingmagazine.com/responsive-web-design-guidelines-tutorials/
  10. 10 https://github.com/w3c/html/issues/40
  11. 11 https://github.com/GoogleChrome/sw-helpers
  12. 12 https://www.smashingmagazine.com/2016/02/making-a-service-worker/
  13. 13 https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
  14. 14 https://letsencrypt.org/
  15. 15 https://github.com/GoogleChrome/sw-toolbox
  16. 16 https://jakearchibald.com/2016/caching-best-practices/
  17. 17 https://www.smashingmagazine.com/wp-content/uploads/2016/09/application-tab-opt.png
  18. 18 https://www.smashingmagazine.com/wp-content/uploads/2016/09/application-tab-opt.png
  19. 19 http://developer.telerik.com/featured/300-ms-click-delay-ios-8/
  20. 20 https://github.com/ftlabs/fastclick
  21. 21 https://csstriggers.com/
  22. 22 https://greensock.com/
  23. 23 https://developers.google.com/web/fundamentals/getting-started/push-notifications/step-07?hl=en
  24. 24 https://www.npmjs.com/package/web-push
  25. 25 https://jakearchibald.github.io/isserviceworkerready/
  26. 26 https://ada.is/blog/2016/06/01/yet-another-progressive-webapp-post/
  27. 27 http://dazeend.org/2015/01/the-shape-of-the-app-store/
  28. 28 https://github.com/GoogleChrome/sw-helpers
  29. 29 https://github.com/GoogleChrome/sw-toolbox
  30. 30 http://developer.telerik.com/featured/300-ms-click-delay-ios-8/
  31. 31 https://jakearchibald.com/2016/caching-best-practices/
  32. 32 https://twitter.com/codepo8
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to topTweet itShare on Facebook

Advertisement

Freebie: Flat Line UX And E-Commerce Icon Sets (83 Icons, AI, EPS, PNG, SVG)

Freebie: Flat Line UX And E-Commerce Icon Sets (83 Icons, AI, EPS, PNG, SVG)

How often do you have to explain the purpose of a study, objectives, goals or measurements within your company? Maybe you need to prepare a presentation or a brief overview of what next steps should be taken, or maybe you simply need to build a shiny, new pattern library?

Whatever project you may be working on, today’s icon sets will come in handy. All of the vector icons were tirelessly crafted by the design team at Ecommerce Website Design121, and come in various formats that can be used for personal as well as commercial purposes.

This exclusive icon pack is licensed under under a Creative Commons Attribution 3.0 Unported2 license. You may modify the size, color or shape of the icons. No attribution is required, however, reselling of bundles or individual pictograms is not cool. Please provide credits to the creators and link to the article in which this freebie was released if you would like to spread the word in blog posts or anywhere else.

Flat Line User Experience Icon Set (45 Icons) Link

This consistent and beautifully diverse icon set offers a retro discreet feel, fading hues of army green, yellow, orange, red and grey, mixing into sharply defined images.

3
A preview of the Flat Line UX icon set. (Large preview4)
A close-up of two icons included in the flat line UX icon set.5
A close-up of two icons included in the flat line UX icon set. (Large preview6)

E-Commerce Linear Icon Set (38 Icons) Link

These e-commerce linear icons come in green, blue and red, displaying an array of signs, shops, clothes, even barcodes and currencies that clarify and lead the shopper. As you want to help, not to confuse your guests and potential clients, these icons are like Santa’s little helpers, taking some of the stress off your hands and wrapping big expectations into small, but mighty editable buttons.

A preview of the E-commerce linear icon set.7
A preview of the E-commerce linear icon set. (Large preview8)
A close-up of two icons included in the e-commerce linear icon set.9
A close-up of two icons included in the e-commerce linear icon set. (Large preview10)

Download The Icon Pack For Free Link

Insights From The Designer Link

“The 45 Flat Line User Experience Icon Set came from a need for UX (User Experience) icons as opposed to the abundance of User Interface icon sets. The retro color scheme and shapes are an escape from the standard ones. The icons are created in 2px line/stroke design filled with colors and details in line style as shapes. The stroke/line are fully editable in the .eps and .ai file.

With online shopping galloping in retail stats like a purebred stallion towards the finish line at the Royal Ascot, no wonder that e-commerce is in high demand. Together with SEO and social media icons, e-commerce icons are some of the most requested sets. As they always come in handy, these 38 E-Commerce Linear Icons are ready to take their job seriously and show up in all the right places. The designer of the collection literally keeps all her ideas and inspiration for colors, designs, shapes, in a special folder. This system helps her quickly answer to the customer’s preferences. Although there are many free e-commerce icons out there, design-wise they aren’t too adventurous. It was the regular RGB colors that inspired the designer to create the color scheme. These are clean, elegant linear e-comm icons with a retro touch – in 2px stroke design on fresh color backgrounds. The stroke/line are fully editable in the .eps and .ai file.”

A big thank you to the team at Ecommerce Website Design121 — we sincerely appreciate your time and efforts. Keep up the brilliant work!

(il, vf)

Footnotes Link

  1. 1 https://ecomm.design/
  2. 2 http://creativecommons.org/licenses/by/3.0/
  3. 3 https://www.smashingmagazine.com/wp-content//uploads/2016/08/flat-line-user-experience-icons-large-preview-opt.png
  4. 4 https://www.smashingmagazine.com/wp-content//uploads/2016/08/flat-line-user-experience-icons-large-preview-opt.png
  5. 5 https://www.smashingmagazine.com/wp-content/uploads/2016/08/ux-linear-closeup-large-preview-opt.png
  6. 6 https://www.smashingmagazine.com/wp-content/uploads/2016/08/ux-linear-closeup-large-preview-opt.png
  7. 7 https://www.smashingmagazine.com/wp-content//uploads/2016/08/e-commerce-linear-icons-large-preview-opt.png
  8. 8 https://www.smashingmagazine.com/wp-content//uploads/2016/08/e-commerce-linear-icons-large-preview-opt.png
  9. 9 https://www.smashingmagazine.com/wp-content/uploads/2016/08/e-commerce-icons-closeup-large-opt.png
  10. 10 https://www.smashingmagazine.com/wp-content/uploads/2016/08/e-commerce-icons-closeup-large-opt.png
  11. 11 http://provide.smashingmagazine.com/Freebies/smashing-freebie-ux-and-ecommerce-icon-sets.zip
  12. 12 https://ecomm.design/
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to topTweet itShare on Facebook

Advertisement

Web Development Reading List #152: On Not Shipping, Pure JS Functions, And SameSite Cookies

Web Development Reading List #152: On Not Shipping, Pure JS Functions, And SameSite Cookies

This week’s reading list consists of a lot of little, smart details that you can use on websites. From tweaking the user’s reading experience during page load to pure JavaScript functions and verifying the integrity of external assets. And finally, we see some articles on thinking differently about established working habits — be it working on AI without data or the virtue of not shipping a feature.

Please note that I’ll be on vacation for the next four weeks, so please don’t expect any new Web Development Reading List before October, 7th. Enjoy September, your work, your life!

General Link

  • Jason Zimdars explains why not shipping a feature can be a virtue1. An article about hidden costs and why shipping does not equal success.
  • While many think Apple isn’t in the Artificial Intelligence game, this exclusive look gives some insights2 into why Apple handles things differently. An interesting read that reveals how Apple tries to do Artificial Intelligence with less user data and without tracking you — contrary to the industry’s big players.
3
Not shipping can be a virtue4. Jason Zimdars shares how one of the most important features he ever designed for Basecamp didn’t make it into the product. (Image credit: Jason Zimdars5)

Concept & Design Link

  • The Web Methodology Project6 is a fresh guide to building web projects, and even though it’s still a work in progress, it already looks very useful. So keep an eye on it.

Tools & Workflows Link

  • Google’s Closure Compiler is one of the best tools out there to compile JavaScript, but so far has only been available as a Java platform tool. Now, the team released a JavaScript version of Closure Compiler7 designed to run in Node.js environments. Available on GitHub8 or npm9.

Security Link

Accessibility Link

Illustration of a person being left behind as travellers speed away in a futuristic ship14
Don’t leave your users behind. Mischa Andrews shares thoughts on how we can make the web more accessible15. (Original artwork by Adam Van Winden16)

JavaScript Link

CSS/Sass Link

  • Michael Scharnagl shares some neat techniques to reduce content shifting during page load19 to ensure a smooth reading experience for users. By setting intrinsic ratios for media, font-size-adjust, or new techniques such as scroll anchoring, you can improve the situation enormously.

Work & Life Link

And with that, I’ll close for this week. If you like what I write each week, please support me with a donation21 or share this resource with other people. You can learn more about the costs of the project here22. It’s available via email, RSS and online.

— Anselm

Footnotes Link

  1. 1 https://m.signalvnoise.com/not-shipping-is-a-virtue-b880badb623c
  2. 2 https://backchannel.com/an-exclusive-look-at-how-ai-and-machine-learning-work-at-apple-8dbfb131932b
  3. 3 https://m.signalvnoise.com/not-shipping-is-a-virtue-b880badb623c
  4. 4 https://m.signalvnoise.com/not-shipping-is-a-virtue-b880badb623c
  5. 5 https://m.signalvnoise.com/not-shipping-is-a-virtue-b880badb623c
  6. 6 http://webmethodologyproject.com/guide/
  7. 7 https://developers.googleblog.com/2016/08/closure-compiler-in-javascript.html
  8. 8 https://github.com/google/closure-compiler-js
  9. 9 https://www.npmjs.com/package/google-closure-compiler-js
  10. 10 https://blog.mozilla.org/security/2016/08/26/mitigating-mime-confusion-attacks-in-firefox/
  11. 11 https://www.troyhunt.com/protecting-your-embedded-content-with-subresource-integrity-sri/
  12. 12 https://www.igvita.com/2016/08/26/stop-cross-site-timing-attacks-with-samesite-cookies/
  13. 13 https://medium.com/@MischaAndrews/the-inaccessible-web-how-we-got-into-this-mess-7cd3460b8e32
  14. 14 https://medium.com/@MischaAndrews/the-inaccessible-web-how-we-got-into-this-mess-7cd3460b8e32
  15. 15 https://medium.com/@MischaAndrews/the-inaccessible-web-how-we-got-into-this-mess-7cd3460b8e32
  16. 16 http://adamvanwinden.tumblr.com/
  17. 17 http://staltz.com/is-your-javascript-function-actually-pure.html
  18. 18 http://staltz.com/react-could-love-web-components.html
  19. 19 https://www.smashingmagazine.com/2016/08/ways-to-reduce-content-shifting-on-page-load/
  20. 20 https://m.signalvnoise.com/its-urgent-really-8050dfe3b921
  21. 21 https://wdrl.info/donate
  22. 22 https://wdrl.info/costs/
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to topTweet itShare on Facebook

Advertisement