[Data Tool] Web Analytics

lookml
blocks
low_priority
webanalytics
done
(Haarthi Sadasivam) #1

About This Tool

Evaluating Web Analytics over time can provide a number of insights into the life of a visitor on your site.

  • How long do visitors tend to stay on your site?
  • What are the average number of pageviews per session?
  • How do recent web trends compare to historical trends?

Providing an dashboard with the flexibility to answer those questions can help you make the necessary adjustments to your web site to improve user retention!

Ideal Data Types

This Block can be applied to any web traffic dataset.

Expected Output

Our Web Analytics tool makes use parameters to allow the end user to select the metrics that they would like to compare side by side at the time of the visualization.

Compare User counts and Pageviews for a select period of time to see how they they correlate with each other!

Get Started

Define Parameters

Parameters (surfaced as a filter-only field in the UI) allow for UI flexibility when selecting dimensions and measures. This can allow the user to define the dimension or measure to pull in to the report at run-time. Start by creating parameters for the different metrics you would like to compare against!

  parameter: primary_metric_name {
    type: unquoted
    default_value: "pageviews"
    allowed_value: {
      value: "pageviews"
      label: "Pageviews"
    }
    allowed_value: {
      value: "users"
      label: "Users"
    }
    allowed_value: {
      value: "sessions"
      label: "Sessions"
    }
    allowed_value: {
      value: "pages_per_session"
      label: "Pages/Session"
    }
    allowed_value: {
      value: "pct_new_visitor"
      label: "% New Visitor"
    }

  }

  parameter: second_metric_name {
    type: unquoted
    allowed_value: {
      value: "pageviews"
      label: "Pageviews"
    }
    allowed_value: {
      value: "users"
      label: "Users"
    }
    allowed_value: {
      value: "sessions"
      label: "Sessions"
    }
    allowed_value: {
      value: "pages_per_session"
      label: "Pages/Session"
    }
    allowed_value: {
      value: "pct_new_visitor"
      label: "% New Visitor"
    }
  }

Define Metrics

  measure: pageviews {
    label: "Pageviews"
    type: sum
  }
  measure: sessions {
    label: "Sessions"
    type: sum
  }
  measure: pages_per_session {
    sql: ${pageviews}/${sessions} ;;
    type: number
    value_format_name: decimal_2
  }

Attach Parameters to Metrics to allow for dynamic selection

You’ll notice that the underlying value of the measure (the column to run the calculation on) gets selected based on the selection of the parameter.

  measure: primary_metric {
    sql: ${TABLE}.{% parameter primary_metric_name %};;
    type: sum
    label_from_parameter: primary_metric_name
  }
  measure: second_metric {
    sql: ${TABLE}.{% parameter second_metric_name %};;
    type: sum
    label_from_parameter: second_metric_name
  }

Build engaging reports and dashboards!

You now have the tools to build engaging web analytics dashboards to compare web metrics side by side!

0 Likes

(Mark Progano) #2

How would you define the pct_new_visitor? I assume that’d need to look at a pervious period or something?

One thought I had now that I’m writing this is count the number of users that that < 2 sessions and assume a new anyone with >= 2 are returning?

0 Likes

(Izzy) #3

That seems reasonable to me! You’d just have to make sure it’s calculated on a rolling basis, right? Otherwise historic metrics would get all wonked up— If your “returning” is calculated as a yes/no based on count of visits, you have to be careful that it’s only looking for events into the past from any given date, not the future :wink:

0 Likes