     {tags} = metadata
     guides = metadata.collections.guide ? []
 
-    addPageViews files, null, ->
-      addApiFiles files, metalsmith, opts, done
+    addPageViews files, null, (err) ->
+      if err? then return done()
+      addApiFiles files, metalsmith, opts, -> done()
 


  authClient.authorize (err, tokens) ->
    # Bail on any errors
    if err? then return throw err

    analytics.data.ga.get
      auth: authClient

      "metrics":"ga:pageViews",
      "dimensions":"ga:pagePath",
      "sort":"-ga:pageViews",
      "max-results":"25"
      (err, result) ->
        if err? then return callback err, result, tokens
        callback null, result.rows ? []


# Query Google Analytics for Page Views and add the
