Thursday, 19 July 2018

How to make a modern dashboard with NVD3.js

NVD3.js is a JavaScript visualization library that is free to use and open source. It’s derived from the well-known d3.js visualization library. When used the right way, this library can be extremely powerful for everyday tasks and even business operations.

For example, an online dashboard. We can use NVD3.js to compile data into a centralized space that visualizes the information in neat charts and graphs. That’s what we’re going to look at in this post.

Making a dashboard with NVD3.js for the first time is daunting, but after this tutorial, you should have the required knowledge to get your hands dirty and start building something awesome. Personally, I have a passion for visualizations on the web. They are both beautiful and meaningful at the same time.

Real-world use case: A data dashboard

Dashboards can be used for pretty much anything. As long as you've got data to analyze, you’re good to go, whether that be some sales data or the average weather for the last 20 years. Let’s build something like this:

See the Pen Dashboard NVD3.JS by Danny Englishby (@DanEnglishby) on CodePen.

Setting up the environment

To setup an NVD3 chart, we require three things:

  1. The NVD3 JavaScript library
  2. The NVD3 CSS library
  3. The D3.js library (a dependency for NVD3)

All of these are available through Cloudflare's CDN network. Here’s an HTML template with all those resources ready to go:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Making a Dashboard</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.6/nv.d3.css">
</head>
<body>
  
  
</body>
</html>

Data sources

For this tutorial, I thought using some raw, factual data that’s already been formatted into JSON would be easiest. I’m using two sources of information: one about global average temperatures over time and the other reporting world population statistics. I've already formatted the data into JSON, so it's ready to copy and paste!

Creating a line chart

Let’s go ahead and create a line chart with some global temperature data. The raw data I've put together in JSON represents the last twenty years of temperature changes compared to the global average.

First, we’ll add a placeholder element for the chart to attach to when the JavaScript is executed.

<div id="averageDegreesLineChart" class='with-3d-shadow with-transitions averageDegreesLineChart'>
  <svg></svg>
</div>

Then add the following JSON in some script tags before the </body> tag:

var temperatureIndexJSON = [
  {
    key: "Temp +- Avg.",
    values: [{ "x": 1998, "y": 0.45 }, { "x": 1999, "y": 0.48 }, { "x": 2000, "y": 0.5 }, { "x": 2001, "y": 0.52 }, { "x": 2002, "y": 0.55 }, { "x": 2003, "y": 0.58 }, { "x": 2004, "y": 0.6 }, { "x": 2005, "y": 0.61 }, { "x": 2006, "y": 0.61 }, { "x": 2007, "y": 0.61 }, { "x": 2008, "y": 0.62 }, { "x": 2009, "y": 0.62 }, { "x": 2010, "y": 0.62 }, { "x": 2011, "y": 0.63 }, { "x": 2012, "y": 0.67 }, { "x": 2013, "y": 0.71 }, { "x": 2014, "y": 0.77 }, { "x": 2015, "y": 0.83 }, { "x": 2016, "y": 0.89 }, { "x": 2017, "y": 0.95 }]
  }
];

The x value is the year and they value is the temperature in Celsius degrees.

The last piece to the puzzle is the most important function that creates the chart. The function named nv.addGraph() is the main function used throughout NVD3 and, within it, you initialize the chart object. In this example, we are using the lineChart object which can have methods chained to it, depending on what the visual requirements may be.

Check out the JavaScript comments to see the which each line does.

nv.addGraph(function () {
  var chart = nv.models.lineChart() // Initialise the lineChart object.
    .useInteractiveGuideline(true); // Turn on interactive guideline (tooltips) 
chart.xAxis
    .axisLabel('TimeStamp (Year)'); // Set the label of the xAxis (Vertical)
chart.yAxis
    .axisLabel('Degrees (c)') // Set the label of the xAxis (Horizontal)
    .tickFormat(d3.format('.02f')); // Rounded Numbers Format.
d3.select('#averageDegreesLineChart svg') // Select the ID of the html element we defined earlier.
    .datum(temperatureIndexJSON) // Pass in the JSON
    .transition().duration(500) // Set transition speed
    .call(chart); // Call & Render the chart
  nv.utils.windowResize(chart.update); // Intitiate listener for window resize so the chart responds and changes width.
  return;
});

See the Pen Line Chart NVD3.JS by Danny Englishby (@DanEnglishby) on CodePen.

Creating two bar charts for the price of one

You will love the minimal effort of these next two charts. The power of NVD3.js enables switching between chart types. You can either have the toggle active so users can switch between a standard bar chart or a stacked bar chart. Or you can force the chart type and make it unchangeable.

The following examples show exactly how to do it.

Stacked multi-bar chart

You know those bar charts that stack two values together in the same bar? That’s what we’re doing here.

<div id="worldPopulationMultiBar" class="with-3d-shadow with-transitions worldPopulationMultiBar">
  <svg></svg>
</div>
var populationBySexAndCountryJSON =[{"key":"Male","color":"#d62728","values":[{"label":"China","value":717723466.166},{"label":"India","value":647356171.132},{"label":"United States of America","value":157464952.272},{"label":"Indonesia","value":125682412.393},{"label":"Brazil","value":98578067.1},{"label":"Pakistan","value":93621293.316},{"label":"Nigeria","value":88370210.605},{"label":"Bangladesh","value":79237050.772},{"label":"Russian Federation","value":65846330.629},{"label":"Japan","value":61918921.999}]},{"key":"Female","color":"#1f77b4","values":[{"label":"China","value":667843070.834},{"label":"India","value":604783424.868},{"label":"United States of America","value":162585763.728},{"label":"Indonesia","value":124183218.607},{"label":"Brazil","value":101783857.9},{"label":"Pakistan","value":88521300.684},{"label":"Nigeria","value":85245134.395},{"label":"Bangladesh","value":77357911.228},{"label":"Russian Federation","value":76987358.371},{"label":"Japan","value":65224655.001}]}];

nv.addGraph(function ()
{
  var chart = nv.models.multiBarChart()
    .x(function (d) {
      return d.label; // Configure x axis to use the "label" within the json.
    })
    .y(function (d) {
      return d.value; // Configure y axis to use the "value" within the json.
    }).margin({top: 30, right: 20, bottom: 50, left: 85}) // Add some CSS Margin to the chart.
    .showControls(false) // Turn of switchable control
    .stacked(true); // Force stacked mode.

  chart.xAxis.axisLabel('Countries'); // add label to the horizontal axis

  chart.yAxis.tickFormat(d3.format('0f')); // Round the yAxis values

  d3.select('#worldPopulationMultiBar svg') // Select the html element by ID
    .datum(populationBySexAndCountryJSON) // Pass in the data
    .transition().duration(500) // Set transition speed
    .call(chart); // Call & Render chart
  
  nv.utils.windowResize(chart.update); // Intitiate listener for window resize so the chart responds and changes width.
  return;
});

The two important settings in the JavaScript here are the .showControls and .stacked booleans. They both do what they say on the tin: force the graph to a stacked bar chart and don't allow switching of the chart type. You will see what I mean by switching soon.

See the Pen Multi StackedBar NVD3.JS by Danny Englishby (@DanEnglishby) on CodePen.

Standard multi-bar chart

Now, let’s do something a little more traditional and compare values side-by-side instead of stacking them in the same bar.

This uses pretty much the same code as the stacked examples, but we can change the .stacked boolean value to false. This will, of course, make the stacked bar chart a normal bar chart.

<div id="worldPopulationMultiBar" class="with-3d-shadow with-transitions worldPopulationMultiBar">
  <svg></svg>
</div>
var populationBySexAndCountryJSON = [{"key":"Male","color":"#d62728","values":[{"label":"China","value":717723466.166},{"label":"India","value":647356171.132},{"label":"United States of America","value":157464952.272},{"label":"Indonesia","value":125682412.393},{"label":"Brazil","value":98578067.1},{"label":"Pakistan","value":93621293.316},{"label":"Nigeria","value":88370210.605},{"label":"Bangladesh","value":79237050.772},{"label":"Russian Federation","value":65846330.629},{"label":"Japan","value":61918921.999}]},{"key":"Female","color":"#1f77b4","values":[{"label":"China","value":667843070.834},{"label":"India","value":604783424.868},{"label":"United States of America","value":162585763.728},{"label":"Indonesia","value":124183218.607},{"label":"Brazil","value":101783857.9},{"label":"Pakistan","value":88521300.684},{"label":"Nigeria","value":85245134.395},{"label":"Bangladesh","value":77357911.228},{"label":"Russian Federation","value":76987358.371},{"label":"Japan","value":65224655.001}]}];

nv.addGraph(function () {
  var chart = nv.models.multiBarChart()
    .x(function (d) {
      return d.label; // Configure x axis to use the "label" within the json.
    })
    .y(function (d) {
      return d.value; // Configure y axis to use the "value" within the json.
    }).margin({top: 30, right: 20, bottom: 50, left: 85}) // Add some CSS Margin to the chart.
    .showControls(false) // Turn of switchable control
    .stacked(false); // ***Force normal bar mode.***

  chart.xAxis.axisLabel('Countries'); // add label to the horizontal axis

  chart.yAxis.tickFormat(d3.format('0f')); // Round the yAxis values

  d3.select('#worldPopulationMultiBar svg') // Select the html element by ID
    .datum(populationBySexAndCountryJSON) // Pass in the data
    .transition().duration(500) // Set transition speed
    .call(chart); // Call & Render chart

  nv.utils.windowResize(chart.update); // Intitiate listener for window resize so the chart responds and changes width.

  return;
});

The one change to the settings presents us with a brand-new looking chart.

See the Pen Multi Bar NVD3.JS by Danny Englishby (@DanEnglishby) on CodePen.

Using one code set with minimal changes, you just created two epic charts for the price of one. Kudos for you!

There is one last setting, of course, if you want the functionality of switching charts. Change the .showControls to true and remove the .stacked option. You will notice some controls at the top of the chart. Clicking them will toggle the view between a stacked and standard chart.

See the Pen Multi Bar Switchable NVD3.JS by Danny Englishby (@DanEnglishby) on CodePen.

Making a dashboard

There's nothing I love looking at more in the world of web development than dashboards. They never get old and are super good looking. By using the charting techniques we’ve already covered, we can make our own responsive dashboard on a single webpage.

If you remember within the JavaScript snippets earlier, there was a function set with a listener against each chart: nv.utils.windowResize(chart.update);

This magical function, resizes the chart for you as if it was set to width: 100% in CSS. But it doesn't just shrink, but also moves and restructures the graph according to the size of the screen. It's pretty awesome! All we need to worry about it are the heights. We can set this up by applying flexbox to the classes assigned to chart elements.

Let’s bundle everything we have so far into one dashboard by wrapping each chart element in a flexbox container. Apply a small amount of CSS for the flexing and height, and finally, compile all the scripts into one (or, you can keep them separate in your own project).

See the Pen Dashboard NVD3.JS by Danny Englishby (@DanEnglishby) on CodePen.

Summary

This tutorial will hopefully give you the knowledge to get started with building data visualizations and, ultimately, add them into a production dashboard. Even if you only want to play with these concepts, I'm sure your mind will start running with ideas for how to transform different types of data into stunning visuals.

The post How to make a modern dashboard with NVD3.js appeared first on CSS-Tricks.



from CSS-Tricks https://ift.tt/2mwKJbI
via IFTTT

​The State of Headless CMS Market

(This is a sponsored post.)

In March and April 2018, Kentico conducted the first global report about the state of headless CMS market. We surveyed 986 CMS practitioners in 85 countries about their opinions, adoption, and plans for using headless CMS. The survey contains valuable industry insights into topics such headless CMS awareness, preferred headless CMS models, current and future uptake of the headless CMS approach, and much more, from leading industry players.

Download your complimentary copy of the full report now.

Direct Link to ArticlePermalink

The post ​The State of Headless CMS Market appeared first on CSS-Tricks.



from CSS-Tricks https://synd.co/2zA8tFo
via IFTTT

Wednesday, 18 July 2018

What bit of advice would you share with someone new to your field?

The most FA of all the FAQs.

Here's Laura Kalbag:

Find what you love. Don’t worry about needing to learn every language, technique or tool. Start with what interests you, and carve your own niche. And then use your powers for good!

And my own:

Buy a domain name. Figure out how to put an HTML file up there. Isn’t that a powerful feeling? Now you’ve got table stakes. Build something.

Definitely, go read other A Book Apart author answers because they are all great. My other favorite is just three words.

Direct Link to ArticlePermalink

The post What bit of advice would you share with someone new to your field? appeared first on CSS-Tricks.



from CSS-Tricks https://ift.tt/2Ld8obQ
via IFTTT

Automate Your Workflow with Node

Tuesday, 17 July 2018

CSS-in-JS: FTW || WTF?

I enjoyed Bruce Lawson's talk on this holiest of wars. It's funny and lighthearted while being well researched and fairly portraying the good arguments on both sides.

The post CSS-in-JS: FTW || WTF? appeared first on CSS-Tricks.



from CSS-Tricks https://ift.tt/2LsModk
via IFTTT

Render Children in React Using Fragment or Array Components

What comes to your mind when React 16 comes up? Context? Error Boundary? Those are on point. React 16 came with those goodies and much more, but In this post, we'll be looking at the rendering power it also introduced — namely, the ability to render children using Fragments and Array Components.

These are new and really exciting concepts that came out of the React 16 release, so let’s look at them closer and get to know them.

Fragments

It used to be that React components could only return a single element. If you have ever tried to return more than one element, you know that you’ll will be greeted with this error: Syntax error: Adjacent JSX elements must be wrapped in an enclosing tag. The way out of that is to make use of a wrapper div or span element that acts as the enclosing tag.

So instead of doing this:

class Countries extends React.Component {
  render() {
    return (
      <li>Canada</li>
      <li>Australia</li>
      <li>Norway</li>
      <li>Mexico</li>
    )
  }
}

...you have to add either an ol or ul tag as a wrapper on those list items:

class Countries extends React.Component {
  render() {
    return (
      <ul>
        <li>Canada</li>
        <li>Australia</li>
        <li>Norway</li>
        <li>Mexico</li>
      </ul>
    )
  }
}

Most times, this may not be the initial design you had for the application, but you are left with no choice but to compromise on this ground.

React 16 solves this with Fragments. This new features allows you to wrap a list of children without adding an extra node. So, instead of adding an additional element as a wrapper like we did in the last example, we can throw <React.Fragment> in there to do the job:

class Countries extends React.Component {
  render() {
    return (
      <React.Fragment>
        <li>Canada</li>
        <li>Australia</li>
        <li>Norway</li>
        <li>Mexico</li>
      </React.Fragment>
    )
  }
}

You may think that doesn’t make much difference. But, imagine a situation where you have a component that lists different items such as fruits and other things. These items are all components, and if you are making use of old React versions, the items in these individual components will have to be wrapped in an enclosing tag. Now, however, you can make use of fragments and do away with that unnecessary markup.

Here’s a sample of what I mean:

class Items extends React.Component {
  render() {
    return (
      <React.Fragment>
        <Fruit />
        <Beverages />
        <Drinks />
      </React.Fragment>
    )
  }
}

We have three child components inside of the fragment and can now create a component for the container that wraps it. This is much more in line with being able to create components out of everything and being able to compile code with less cruft.

Fragment Shorthand

There is a shorthand syntax when working with Fragments, which you can use. Staying true to its fragment nature, the syntax is like a fragment itself, leaving only only empty brackets behind.

Going back to our last example:

class Fruit extends React.Component {
  render() {
    return (
      <>
        <li>Apple</li>
        <li>Orange</li>
        <li>Blueberry</li>
        <li>Cherry</li>
      </>
    )
  }
}

Question: Is a fragment better than a container div?

You may be looking for a good reason to use Fragments instead of the container div you have always been using. Dan Abramov answered the question on StackOverflow. To summarize:

  1. It’s a tiny bit faster and has less memory usage (no need to create an extra DOM node). This only has a real benefit on very large and/or deep trees, but application performance often suffers from death by a thousand cuts. This is one less cut.
  2. Some CSS mechanisms like flexbox and grid have a special parent-child relationship, and adding divs in the middle makes it harder to maintain the design while extracting logical components.
  3. The DOM inspector is less cluttered.

Keys in Fragments

When mapping a list of items, you still need to make use of keys the same way as before. For example, let's say we want to pass a list of items as props from a parent component to a child component. In the child component, we want to map through the list of items we have and output each item as a separate entity. Here’s how that looks:

const preload = {
  "data" : [
    {
      "name": "Reactjs",
      "url": "https://reactjs.org",
      "description": "A JavaScript library for building user interfaces",
    },
    {
      "name": "Vuejs",
      "url": "https://vuejs.org",
      "description": "The Progressive JavaScript Framework",
    },
    {
      "name": "Emberjs",
      "url": "https://www.emberjs.com",
      "description": "Ember.js is an open-source JavaScript web framework, based on the Model–view–viewmodel pattern"
    }
  ]
}

const Frameworks = (props) => {
  return (
    <React.Fragment>
      {props.items.data.map(item => (
        <React.Fragment key={item.id}>
          <h2>{item.name}</h2>
          <p>{item.url}</p>
          <p>{item.description}</p>
        </React.Fragment>
      ))}
    </React.Fragment>
  )
}

const App = () => {
  return (
    <Frameworks items={preload} />
  )
}

See the Pen React Fragment Pen by Kingsley Silas Chijioke (@kinsomicrote) on CodePen.

You can see that now, in this case, we are not making use of any divs in the Frameworks component. That’s the key difference!

Render Children Using an Array of Components

The second specific thing that came out of React 16 we want to look at is the ability to render multiple children using an array of components. This is a clear timesaver because it allows us to cram as many into a render instead of having to do it one-by-one.

Here is an example:

class Frameworks extends React.Component {
  render () {
    return (
      [
        <p>JavaScript:</p>
        <li>React</li>,
        <li>Vuejs</li>,
        <li>Angular</li>
      ]
    )
  }
}

You can also do the same with a stateless functional component:

const Frontend = () => {
  return [
    <h3>Front-End:</h3>,
    <li>Reactjs</li>,
    <li>Vuejs</li>
  ]
}

const Backend = () => {
  return [
    <h3>Back-End:</h3>,
    <li>Express</li>,
    <li>Restify</li>
  ]
}

const App = () => {
  return [
    <h2>JavaScript Tools</h2>,
    <Frontend />,
    <Backend />
  ]
}

See the Pen React Fragment 2 Pen by Kingsley Silas Chijioke (@kinsomicrote) on CodePen.

Conclusion

Like the Context API and Error Boundary feature that were introduced in React 16, rendering children components with Fragment and multiples of them with Array Components are two more awesome features you can start making use of as you build your application.

Have you started using these in a project? Let me know how in the comments so we can compare notes. 🙂

The post Render Children in React Using Fragment or Array Components appeared first on CSS-Tricks.



from CSS-Tricks https://ift.tt/2JvuHIi
via IFTTT

The Local SEO’s Guide to the Buy Local Phenomenon: A Competitive Advantage for Clients

Posted by MiriamEllis

Photo credit: Michelle Shirley

What if a single conversation with one of your small local business clients could spark activity that would lead to an increase in their YOY sales of more than 7%, as opposed to only 4% if you don’t have the conversation? What if this chat could triple the amount of spending that stays in their town, reduce pollution in their community, improve their neighbors’ health, and strengthen democracy?

What if the brass ring of content dev, link opportunities, consumer sentiment and realtime local inventory is just waiting for you to grab it, on a ride we just haven’t taken yet, in a setting we’re just not talking about?

Let’s travel a different road today, one that parallels our industry’s typical conversation about citations, reviews, markup, and Google My Business. As a 15-year sailor on the Local SEO ship, I love all this stuff, but, like you, I’m experiencing a merging of online goals with offline realities, a heightened awareness of how in-store is where local business successes are born and bred, before they become mirrored on the web.

At Moz, our SaaS tools serve businesses of every kind: Digital, bricks-and-mortar, SABs, enterprises, mid-market agencies, big brands, and bootstrappers. But today, I’m going to go as small and as local as possible, speaking directly to independently-owned local businesses and their marketers about the buy local/shop local/go local movement and what I’ve learned about its potential to deliver meaningful and far-reaching successes. Frankly, I think you’ll be as amazed as I’ve been.

At the very least, I hope reading this article will inspire you to have a conversation with your local business clients about what this growing phenomenon could do for them and for their communities. Successful clients, after all, are the very best kind to have.

What is the Buy Local movement all about?

What’s the big idea?

You’re familiar with the concept of there being power in numbers. A single independent business lacks the resources and clout to determine the local decisions and policies that affect it. Should Walmart or Target be invited to set up shop in town? Should the crumbling building on Main St. be renovated or demolished? Which safety and cultural services should be supported with funding? The family running the small grocery store has little say, but if they join together with the folks running the bakery, the community credit union, the animal shelter, and the bookstore ... then they begin to have a stronger voice.

Who does this?

Buy Local programs formalize the process of independently-owned businesses joining together to educate their communities about the considerable benefits to nearly everyone of living in a thriving local economy. These efforts can be initiated by merchants, Chambers of Commerce, grassroots citizen groups, or others. They can be assisted and supported by non-profit organizations like the American Independent Business Alliance (AMIBA) and the Institute for Local Self-Reliance (ILSR).

What are the goals?

Through signage, educational events, media promotions, and other forms of marketing, most Buy Local campaigns share some or all of these goals:

  • Increase local wealth that recirculates within the community
  • Preserve local character
  • Build community
  • Create good jobs
  • Have a say in policy-making
  • Decrease environmental impacts
  • Support entrepreneurship
  • Improve diversity/variety
  • Compete with big businesses

Do Buy Local campaigns actually work?

Yes - research indicates that, if managed correctly, these programs yield a variety of benefits to both merchants and residents. Consider these findings:

1) Healthy YOY sales advantages

ILSR conducted a national survey of independent businesses to gauge YOY sales patterns. 2016 respondents reported a good increase in sales across the board, but with a significant difference which AMIBA sums up:

“Businesses in communities with a sustained grassroots “buy independent/buy local” campaign reported a strong 7.4% sales increase, nearly doubling the 4.2% gain for those in areas without such an alliance.”

2) Keeping spending local

The analysts at Civic Economics conducted surveys of 10 cities to gauge the local financial impacts of independents vs. chain retailers, yielding a series of graphics like this one:

While statistics vary from community to community, the overall pattern is one of significantly greater local recirculation of wealth in the independent vs. chain environment. These patterns can be put to good use by Buy Local campaigns with the goal of increasing community-sustaining wealth.

3) Keeping communities employed and safe

Few communities can safely afford the loss of jobs and tax revenue documented in a second Civic Economics study which details the impacts of Americans’ Amazon habit, state by state and across the nation:

While the recent supreme court ruling allowing states to tax e-commerce models could improve some of these dire numbers, towns and cities with Buy Local alliances can speak plainly: Lack of tax revenue that leads to lack of funding for emergency services like fire departments is simply unsafe and unsustainable. A study done a few years back found that ⅔ of volunteer firefighters in the US report that their departments are underfunded with 86% of these heroic workers having to dip into their own pockets to buy supplies to keep their stations going. As I jot these statistics down, there is a runaway 10,000 acre wildfire burning a couple of hours north of me…

Meanwhile, Inc.com is pointing out,

“According to the Bureau of Labor Statistics, since the end of the Great Recession, small businesses have created 62 percent of all net new private-sector jobs. Among those jobs, 66 percent were created by existing businesses, while 34 percent were generated through new establishments (adjusted for establishment closings and job losses)”.

When communities have Go Local-style business alliances, they are capitalizing on the ability to create jobs, increase sales, and build up tax revenue that could make a serious difference not just to local unemployment rates, but to local safety.

4) Shaping policy

In terms of empowering communities to shape policy, there are many anecdotes to choose from, but one of the most celebrated surrounds a landmark study conducted by the Austin Independent Business Alliance which documented community impacts of spending at the local book and music stores vs. a proposed Borders. Their findings were compelling enough to convince the city not to give a $2.1 million subsidy to the now-defunct corporation.

5) Improving the local environment

A single statistic here is incredibly eye opening. According to the US Department of Transportation, shopping-related driving per household more than tripled between 1969-2009.

All you have to do is picture to yourself the centralized location of mainstreet businesses vs. big boxes on the outskirts of town to imagine how city planning has contributed to this stunning rise in time spent on the road. When residents can walk or bike to make daily purchases, the positive environmental impacts are obvious.

6) Improving residents’ health and well-being

A recent Cigna survey of 20,000 Americans found that nearly half of them always or sometimes feel lonely, lacking in significant face-to-face interactions with others. Why does this matter? Because the American Psychological Association finds that you have a 50% less chance of dying prematurely if you have quality social interactions.

There’s a reason author Jan Karon’s “Mitford” series about life in a small town in North Carolina has been a string of NY Times Best Sellers; readers and reviewers continuously state that they yearn to live someplace like this fictitious community with the slogan “Mitford takes care of its own”. In the novels, the lives of residents, independent merchants, and “outsiders” interweave, in good times and bad, creating a support network many Americans envy.

This societal setup must be a winner, as well as a bestseller, because the Cambridge Journal of Regions published a paper in which they propose that the concentration of small businesses in a given community can be equated with levels of public health.

Beyond the theory that eating fresh and local is good for you, it turns out that knowing your farmer, your banker, your grocer could help you live longer.

7) Realizing big-picture goals

Speaking of memorable stories, this video from ILSR does a good job of detailing one view of the ultimate impacts independent business alliances can have on shaping community futures:

https://www.youtube.com/watch?time_continue=150&=&v=kDw4dZLSDXg

I interviewed author and AMIBA co-founder, Jeff Milchen, about the good things that can happen when independents join hands. He summed it up,

“The results really speak for themselves when you look at what the impact of public education for local alliances has been in terms of shifting culture. It’s a great investment for independent businesses to partner with other independents, to do things they can’t do individually. Forming these partnerships can help them compete with the online giants.”

Getting going with a Go Local campaign, the right way

If sharing some of the above with clients has made them receptive to further exploration of what involvement in an independent business alliance might do for them, here are the next steps to take:

  1. First, find out if a Go Local/Shop Local/Buy Local/Stay Local campaign already exists in the business’ community. If so, the client can join up.
  2. If not, contact AMIBA. The good folks there will know if other local business owners in the client’s community have already expressed interest in creating an alliance. They can help connect the interested parties up.
  3. I highly, highly recommend reading through Amiba’s nice, free primer covering just about everything you need to know about Go Local campaigns.
  4. Encourage the client to publicize their intent to create an alliance if none exists in their community. Do an op ed in the local print news, put it on social media sites, talk to neighbors. This can prompt outreach from potential allies in the effort.
  5. A given group can determine to go it alone, but it may be better to rely on the past experience of others who have already created successful campaigns. AMIBA offers a variety of paid community training modules, including expert speakers, workshops, and on-site consultations. Each community can write in to request a quote for a training plan that will work best for them. The organization also offers a wealth of free educational materials on their website.
  6. According to AMIBA’s Jeff Milchen, a typical Buy Local campaign takes about 3-4 months to get going.

It’s important to know that Go Local campaigns can fail, due to poor execution. Here is a roundup of practices all alliances should focus on to avoid the most common pitfalls:

  1. Codify the definition of a “local” business as being independently-owned-and-run, or else big chain inclusion will anger some members and cause them to leave.
  2. Emphasize all forms of local patronage; campaigns that stick too closely to words like “buy” or “shop” overlook the small banks, service area businesses, and other models that are an integral part of the independent local economy.
  3. Ensure diversity in leadership; an alliance that fails to reflect the resources of age, race, gender/identity, political views, economics and other factors may wind up perishing from narrow viewpoints. On a related note, AMIBA has been particularly active in advocating for business communities to rid themselves of bigotry. Strong communities welcome everyone.
  4. Do the math of what success looks like; education is a major contributing factor to forging a strong alliance, based on projected numbers of what campaigns can yield in concrete benefits for both merchants and residents.
  5. Differentiate inventory and offerings so that independently-owned businesses offer something of added value which patrons can’t easily replicate online; this could be specialty local products, face-to-face time with expert staff, or other benefits.
  6. Take the high road in inspiring the community to increase local spending; campaigns should not rely on vilifying big and online businesses or asking for patronage out of pity. In other words, guilt-tripping locals because they do some of their shopping at Walmart or Amazon isn’t a good strategy. Even a 10% shift towards local spending can have positive impacts for a community!
  7. Clearly assess community resources; not every town, city, or district hosts the necessary mix of independent businesses to create a strong campaign. For example, approximately 2.2% of the US population live in “food deserts”, many miles from a grocery store. These areas may lack other local businesses, as well, and their communities may need to create grassroots campaigns surrounding neighborhood gardens, mobile markets, private investors and other creative solutions.

In sum, success significantly depends on having clear definitions, clear goals, diverse participants and a proud identity as independents, devoid of shaming tactics.

Circling back to the Web — our native heath!

So, let’s say that your incoming client is now participating in a Buy Local program. Awesome! Now, where do we go from here?

In speaking with Jeff Milchen, I asked what he has seen in terms of digital marketing being used to promote the businesses involved in Buy Local campaigns. He said that, while some alliances have workshops, it’s a work in progress and something he hopes to see grow in the future.

As a Local SEO, that future is now for you and your fortunate clients. Here are some ways I see this working out beautifully:

Basic data distribution and consistency

Small local businesses can sometimes be unaware of inconsistent or absent local business listings, because the owners are just so busy. The quickest way I know to demo this scenario is to plug the company name and zip into the free Moz Check Listing tool to show them how they’re doing on the majors. Correct data errors and fill in the blanks, either manually, or, using affordable software like Moz Local. You’ll also want to be sure the client has a presence on any geo or industry-specific directories and platforms. It’s something your agency can really help with!

A hyperlocalized content powerhouse

Build proud content around the company’s involvement in the Buy Local program.

  • Write about all of the economic, environmental, and societal benefits residents can support by patronizing the business.
  • Motivated independents take time to know their customers. There are stories in this. Write about the customers and their needs. I’ve even seen independent restaurants naming menu items after beloved patrons. Get personal. Build community.
  • Don’t forget that even small towns can be powerful points of interest for tourists. Create a warm welcome for travelers, and for new neighbors, too!

Link building opportunities of a lifetime

Local business alliances form strong B2B bonds.

  • Find relationships with related businesses that can sprout links. For example, the caterer knows the wedding cake baker, who knows the professional seamstress, who knows the minister, who knows the DJ, who knows the florist.
  • Dive deep into opportunities for sponsoring local organizations, teams and events, hosting and participating in workshops and conferences, offering scholarships and special deals.
  • Make fast friends with local media. Be newsworthy.

A wellspring of sentiment

Independents form strong business-to-community bonds.

  • When a business really knows its customers, asking for online reviews is so much easier. In some communities, it may be necessary to teach customers how to leave reviews, but once you get a strategy going for this, the rest is gravy.
  • It’s also a natural fit for asking for written and video testimonials to be published on the company website.
  • Don’t forget the power of Word of Mouth Marketing, while you’re at it. Loyal patrons are an incredible asset.
  • The one drawback could be if your business model is one of a sensitive nature. Tight-knit communities can be ones in residents may be more desirous of protecting their privacy.

Digitize inventory easily

30% of consumers say they’d buy from a local store instead of online if they knew the store was nearby (Google). Over half of consumers prefer to shop in-store to interact with products (Local Search Association). Over 63% of consumers would rather buy from a company they consider to be authentic over the competition (Bright Local).

It all adds up to the need for highly-authentic independently-owned businesses to have an online presence that signals to Internet users that they stock desired products. For many small, local brands, going full e-commerce on their website is simply too big of an implementation and management task. It’s a problem that’s dogged this particular business sector for years. And it’s why I got excited when the folks at AMIBA told me to check out Pointy.

Pointy offers a physical device that small business owners can attach to their barcode scanner to have their products ported to a Pointy-controlled webpage. But, that’s not all. Pointy integrates with the “See What’s In Store” inventory function of Google My Business Knowledge Panels. Check out Talbot’s Toyland in San Mateo, CA for a live example.

Pointy is a startup, but one that is exciting enough to have received angel investing from the founder of Wordpress and the co-founder of Google Maps. Looks like a real winner to me, and it could provide a genuine answer for brick-and-mortar independents who have found their sales staggering in the wake of Amazon and other big digital brands.

Local SEOs have an important part to play

Satisfaction in work is a thing to be cherished. If the independent business movement speaks to you, bringing your local search marketing skills to these alliances and small brands could make more of your work days really good days.

The scenario could be an especially good fit for agencies that have specialized in city or state marketing. For example, one of our Moz Community members confines his projects to South Carolina. Imagine him taking it on the road a bit, hosting and attending workshops for towns across the state that are ready to revitalize main street. An energetic client roster could certainly result if someone like him could show local banks, grocery stores, retail shops and restaurants how to use the power of the local web!

Reading America

Our industry is living and working in complex times.

The bad news is, a current Bush-Biden poll finds that 8/10 US residents are “somewhat” or “very” concerned about the state of democracy in our nation.

The not-so-bad news is that citizen ingenuity for discovering solutions and opportunities is still going strong. We need only look as far as the runaway success of the TV show “Fixer Upper”, which drew 5.21 million viewers in its fourth season as the second-largest telecast of Q2 of that year. The show surrounded the revitalization of dilapidated homes and businesses in and around Waco, Texas, and has turned the entire town into a major tourist destination, pulling in millions of annual visitors and landing book deals, a magazine, and the Magnolia Home furnishing line for its entrepreneurial hosts.

While not every town can (or would want to) experience what is being called the “Magnolia effect”, channels like HGTV and the DIY network are heavily capitalizing on the rebirth of American communities, and private citizens are taking matters into their own hands.

There’s the family who moved from Washington D.C. to Water Valley, Mississippi, bought part of the decaying main street and began to refurbish it. I found the video story of this completely riveting, and look at the Yelp reviews of the amazing grocery store and lunch counter these folks are operating now. The market carries local products, including hoop cheese and milk from the first dairy anyone had opened in 50 years in the state.

There are the half-dozen millennials who are helping turn New Providence, Iowa into a place young families can live and work again. There’s Corning, NY, Greensburg, KS, Colorado Springs, CO, and so many more places where people are eagerly looking to strengthen community sufficiency and sustainability.

Some marketing firms are visionary forerunners in this phenomenon, like Deluxe, which has sponsored the Small Business Revolution show, doing mainstreet makeovers that are bringing towns back to life. There could be a place out there somewhere on the map of the country, just waiting for your agency to fill it.

The best news is that change is possible. A recent study in Science magazine states that the tipping point for a minority group to change a majority viewpoint is 25% of the population. This is welcome news at a time when 80% of citizens are feeling doubtful about the state of our democracy. There are 28 million small businesses in the United States - an astonishing potential educational force - if communities can be taught what a vote with their dollar can do in terms of giving them a voice. As Jeff Milchen told me:

One of the most inspiring things is when we see local organizations helping residents to be more engaged in the future of their community. Most communities feel somewhat powerless. When you see towns realize they have the ability to shift public policy to support their own community, that’s empowering.”

Sometimes, the extremes of our industry can make our society and our democracy hard to read. On the one hand, the largest brands developing AI, checkout-less shopping, driverless cars, same-day delivery via robotics, and the gig economy win applause at conferences.

On the other hand, the public is increasingly hearing the stories of employees at these same companies who are protesting Microsoft developing face recognition for ICE, Google’s development of AI drone footage analysis for the Pentagon, working conditions at Amazon warehouses that allegedly preclude bathroom breaks and have put people in the hospital, and the various outcomes of the “Walmart Effect”.

The Buy Local movement is poised in time at this interesting moment, in which our democracy gets to choose. Gigs or unions? Know your robot or know your farmer? Convenience or compassion? Is it either/or? Can it be both?

Both big and small brands have a major role to play in answering these timely questions and shaping the ethics of our economy. Big brands, after all, have tremendous resources for raising the bar for ethical business practices. Your agency likely wants to serve both types of clients, but it’s all to the good if all business sectors remember that the real choosers are the “consumers”, the everyday folks voting with their dollars.

I know that it can be hard to find good news sometimes. But I’m hoping what you’ve read today gifts you with a feeling of optimism that you can take to the office, take to your independently-owned local business clients, and maybe even help take to their communities. Spark a conversation today and you may stumble upon a meaningful competitive advantage for your agency and its most local customers.

Every year, local SEOs are delving deeper and deeper into the offline realities of the brands they serve, large and small. We’re learning so much, together. It’s sometimes a heartbreaker, but always an honor, being part of this local journey.


Sign up for The Moz Top 10, a semimonthly mailer updating you on the top ten hottest pieces of SEO news, tips, and rad links uncovered by the Moz team. Think of it as your exclusive digest of stuff you don't have time to hunt down but want to read!



from The Moz Blog https://ift.tt/2JucgDC
via IFTTT

How to make a modern dashboard with NVD3.js

NVD3.js is a JavaScript visualization library that is free to use and open source. It’s derived from the well-known d3.js visualization li...