def __init__(self) -> None: self.name = "Top videos by region" self.dimensions = Dimensions(Required("video")) self.filters = Filters( ZeroOrOne("country", "continent", "subContinent")) self.metrics = Metrics(*data.ALL_VIDEO_METRICS) self.sort_options = SortOptions(*data.TOP_VIDEOS_EXTRA_SORT_OPTIONS, descending_only=True) self.max_results = 200
def __init__(self) -> None: self.name = "Ad performance" self.dimensions = Dimensions(Required("adType"), Optional("day")) self.filters = Filters( ZeroOrOne("video", "group"), ZeroOrOne("country", "continent", "subContinent"), ) self.metrics = Metrics("grossRevenue", "adImpressions", "cpm") self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Top videos by state" self.dimensions = Dimensions(Required("video")) self.filters = Filters(Required("province"), Optional("subscribedStatus")) self.metrics = Metrics(*data.ALL_PROVINCE_METRICS) self.sort_options = SortOptions(*data.TOP_VIDEOS_SORT_OPTIONS, descending_only=True) self.max_results = 200
def __init__(self) -> None: self.name = "Time-based activity (US)" self.dimensions = Dimensions(ExactlyOne("day", "month")) self.filters = Filters( Required("province"), ZeroOrOne("video", "group"), ) self.metrics = Metrics(*data.ALL_PROVINCE_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Geography-based activity" self.dimensions = Dimensions(Required("country")) self.filters = Filters( ZeroOrOne("continent", "subContinent"), ZeroOrOne("video", "group"), ) self.metrics = Metrics(*data.ALL_VIDEO_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Geography-based activity (US)" self.dimensions = Dimensions(Required("province")) self.filters = Filters( Required("country==US"), ZeroOrOne("video", "group"), ) self.metrics = Metrics(*data.ALL_PROVINCE_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "User activity by subscribed status (US)" self.dimensions = Dimensions(Optional("subscribedStatus"), ZeroOrOne("day", "month")) self.filters = Filters( ZeroOrOne("video", "group"), ZeroOrMore("province", "subscribedStatus"), ) self.metrics = Metrics(*data.LESSER_SUBSCRIPTION_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Audience retention" self.dimensions = Dimensions(Required("elapsedVideoTimeRatio")) self.filters = Filters( Required("video"), ZeroOrMore("audienceType", "subscribedStatus", "youtubeProduct"), ) self.metrics = Metrics("audienceWatchRatio", "relativeRetentionPerformance") self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Top videos by playback detail" self.dimensions = Dimensions(Required("video")) self.filters = Filters( ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrMore("liveOrOnDemand", "subscribedStatus", "youtubeProduct"), ) self.metrics = Metrics(*data.VIEW_PERCENTAGE_PLAYBACK_DETAIL_METRICS) self.sort_options = SortOptions(*data.TOP_VIDEOS_SORT_OPTIONS, descending_only=True) self.max_results = 200
def __init__(self) -> None: self.name = "Top playlists" self.dimensions = Dimensions(Required("playlist")) self.filters = Filters( Required("isCurated==1"), ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrMore("playlist", "subscribedStatus", "youtubeProduct"), ) self.metrics = Metrics(*data.ALL_PLAYLIST_METRICS) self.sort_options = SortOptions(*data.TOP_VIDEOS_SORT_OPTIONS) self.max_results = 200
def __init__(self) -> None: self.name = "Basic user activity for playlists" self.dimensions = Dimensions() self.filters = Filters( Required("isCurated==1"), ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrOne("playlist", "group"), ZeroOrMore("subscribedStatus", "youtubeProduct"), ) self.metrics = Metrics(*data.ALL_PLAYLIST_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Top videos by subscription status" self.dimensions = Dimensions(Required("video")) self.filters = Filters( Optional("subscribedStatus"), ZeroOrOne("country", "continent", "subContinent"), ) self.metrics = Metrics(*data.SUBSCRIPTION_METRICS) self.sort_options = SortOptions(*data.TOP_VIDEOS_SORT_OPTIONS, descending_only=True) self.max_results = 200
def __init__(self) -> None: self.name = "User activity by subscribed status" self.dimensions = Dimensions(Optional("subscribedStatus"), ZeroOrOne("day", "month")) self.filters = Filters( ZeroOrOne("country", "continent", "subContinent"), ZeroOrOne("video", "group"), Optional("subscribedStatus"), ) self.metrics = Metrics(*data.SUBSCRIPTION_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Geography-based playback details (view percentage, US)" self.dimensions = Dimensions( Required("province"), ZeroOrMore("subscribedStatus", "youtubeProduct"), ) self.filters = Filters( Required("country==US"), ZeroOrOne("video", "group"), ZeroOrMore("subscribedStatus", "youtubeProduct"), ) self.metrics = Metrics(*data.VIEW_PERCENTAGE_PLAYBACK_DETAIL_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Engagement and content sharing" self.dimensions = Dimensions( Required("sharingService"), Optional("subscribedStatus"), ) self.filters = Filters( ZeroOrOne("country", "continent", "subContinent"), ZeroOrOne("video", "group"), Optional("subscribedStatus"), ) self.metrics = Metrics("viewerPercentage") self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Geography-based activity for playlists (US)" self.dimensions = Dimensions( Required("province"), ZeroOrMore("subscribedStatus", "youtubeProduct"), ) self.filters = Filters( Required("isCurated==1", "country==US"), ZeroOrOne("playlist", "group"), ZeroOrMore("subscribedStatus", "youtubeProduct"), ) self.metrics = Metrics(*data.ALL_PLAYLIST_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Traffic sources" self.dimensions = Dimensions( Required("insightTrafficSourceType"), ZeroOrMore("day", "liveOrOnDemand", "subscribedStatus"), ) self.filters = Filters( ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrOne("video", "group"), ZeroOrMore("liveOrOnDemand", "subscribedStatus"), ) self.metrics = Metrics(*data.LOCATION_AND_TRAFFIC_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Traffic sources (detailed)" self.dimensions = Dimensions(Required("insightTrafficSourceDetail"), ) self.filters = Filters( Required("insightTrafficSourceType"), ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrOne("video", "group"), ZeroOrMore("liveOrOnDemand", "subscribedStatus"), ) self.metrics = Metrics(*data.LOCATION_AND_TRAFFIC_METRICS) self.sort_options = SortOptions( *data.LOCATION_AND_TRAFFIC_SORT_OPTIONS, descending_only=True) self.max_results = 25
def __init__(self) -> None: self.name = "Time-based playback details (view percentage)" self.dimensions = Dimensions( ZeroOrMore("subscribedStatus", "youtubeProduct"), ZeroOrOne("day", "month"), ) self.filters = Filters( ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrOne("video", "group"), ZeroOrMore("subscribedStatus", "youtubeProduct"), ) self.metrics = Metrics(*data.VIEW_PERCENTAGE_PLAYBACK_DETAIL_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Geography-based playback details (live)" self.dimensions = Dimensions( Required("country"), ZeroOrMore("liveOrOnDemand", "subscribedStatus", "youtubeProduct"), ) self.filters = Filters( ZeroOrOne("continent", "subContinent"), ZeroOrOne("video", "group"), ZeroOrMore("liveOrOnDemand", "subscribedStatus", "youtubeProduct"), ) self.metrics = Metrics(*data.LIVE_PLAYBACK_DETAIL_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Viewer demographics" self.dimensions = Dimensions( OneOrMore("ageGroup", "gender"), ZeroOrMore("liveOrOnDemand", "subscribedStatus"), ) self.filters = Filters( ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrOne("video", "group"), ZeroOrMore("liveOrOnDemand", "subscribedStatus"), ) self.metrics = Metrics("viewerPercentage") self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Viewer demographics for playlists" self.dimensions = Dimensions( OneOrMore("ageGroup", "gender"), Optional("subscribedStatus"), ) self.filters = Filters( Required("isCurated==1"), ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrOne("playlist", "group"), ZeroOrMore("subscribedStatus"), ) self.metrics = Metrics("viewerPercentage") self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Device types and operating systems for playlists" self.dimensions = Dimensions( Required("deviceType", "operatingSystem"), ZeroOrMore("day", "subscribedStatus", "youtubeProduct"), ) self.filters = Filters( Required("isCurated==1"), ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrOne("playlist", "group"), ZeroOrMore("subscribedStatus", "youtubeProduct"), ) self.metrics = Metrics(*data.LOCATION_AND_TRAFFIC_PLAYLIST_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Traffic sources for playlists" self.dimensions = Dimensions( Required("insightTrafficSourceType"), ZeroOrMore("day", "subscribedStatus"), ) self.filters = Filters( Required("isCurated==1"), ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrOne("playlist", "group"), Optional("subscribedStatus"), ) self.metrics = Metrics(*data.LOCATION_AND_TRAFFIC_PLAYLIST_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def __init__(self) -> None: self.name = "Traffic sources for playlists (detailed)" self.dimensions = Dimensions(Required("insightTrafficSourceDetail"), ) self.filters = Filters( Required("isCurated==1", "insightTrafficSourceType"), ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrOne("playlist", "group"), Optional("subscribedStatus"), ) self.metrics = Metrics(*data.LOCATION_AND_TRAFFIC_PLAYLIST_METRICS) self.sort_options = SortOptions( *data.LOCATION_AND_TRAFFIC_PLAYLIST_SORT_OPTIONS, descending_only=True) self.max_results = 25
def __init__(self) -> None: self.name = "Operating systems" self.dimensions = Dimensions( Required("operatingSystem"), ZeroOrMore("day", "liveOrOnDemand", "subscribedStatus", "youtubeProduct"), ) self.filters = Filters( ZeroOrOne("country", "province", "continent", "subContinent"), ZeroOrOne("video", "group"), ZeroOrMore( "deviceType", "liveOrOnDemand", "subscribedStatus", "youtubeProduct", ), ) self.metrics = Metrics(*data.LOCATION_AND_TRAFFIC_METRICS) self.sort_options = SortOptions(*self.metrics.values)
def test_dimensions_not_equal_required(dimensions_required): assert dimensions_required != Dimensions(Required("country", "subContinent"))
def test_dimensions_equal(dimensions_required): assert dimensions_required == Dimensions(Required("day", "month"))
def dimensions_required() -> Dimensions: return Dimensions(Required("day", "month"))
def dimensions_zero_or_more() -> Dimensions: return Dimensions(ZeroOrMore("day", "month"))