Method: Yt::Models::VideoGroup#card_click_rate

Defined in:
lib/yt/models/video_group.rb

#card_click_rate(options = {}) ⇒ Hash<Date, Float>, ...

Returns the card_click_rate grouped by the given dimension.

Examples:

Get the card_click_rate for each day of last week:

resource.card_click_rate since: 2.weeks.ago, until: 1.week.ago, by: :day
# => {Wed, 8 May 2014 => 12.0, Thu, 9 May 2014 => 34.0, …}

Get the card_click_rate for this and last month:

resource.card_click_rate since: 1.month.ago, by: :month
# => {Wed, 01 Apr 2014..Thu, 30 Apr 2014 => 12.0, Fri, 01 May 2014..Sun, 31 May 2014 => 34.0, …}

Get the card_click_rate for this and last week:

resource.card_click_rate since: 1.week.ago, by: :week
# => {Wed, 01 Apr 2014..Tue, 07 Apr 2014 => 20.0, Wed, 08 Apr 2014..Tue, 14 Apr 2014 => 13.0, …}

Get the card_click_rate for the whole last week:

resource.card_click_rate since: 2.weeks.ago, until: 1.week.ago, by: :range
# => {total: 564.0}

Get the card_click_rate for the whole last week in Texas only:

resource.card_click_rate since: 2.weeks.ago, until: 1.week.ago, by: :range, in: {state: 'TX'}
# => {total: 19.0}

Parameters:

  • options (Hash) (defaults to: {})

    the time-range and dimensions for the card_click_rate.

Options Hash (options):

  • :by (Symbol) — default: :day

    The dimension to collect card_click_rate by. Accepted values are: :day, :week, :month, :range.

  • :since (#to_date)

    The first day of the time-range. Also aliased as :from.

  • :until (#to_date)

    The last day of the time-range. Also aliased as :to.

  • :in (<String, Hash>)

    The location to limit the card_click_rate to. Can either be the two-letter ISO-3166-1 code of a country, such as “US”, or a Hash that either contains the :country key, such as {country: “US”} or the :state key, such as {state: “TX”}. Note that YouTube API only provides data for US states.

Returns:

  • (Hash<Date, Float>)

    if grouped by day, the card_click_rate for each day in the time-range.

  • (Hash<Range<Date, Date>, Float>)

    if grouped by month, the card_click_rate for each month in the time-range.

  • (Hash<Range<Date, Date>, Float>)

    if grouped by week, the card_click_rate for each week in the time-range.

  • (Hash<Symbol, Float>)

    if grouped by range, the card_click_rate for the entire time-range (under the key :total).



96
# File 'lib/yt/models/video_group.rb', line 96

has_report :card_click_rate, Float