artsy / metaphysics

Artsy's GraphQL API
MIT License
360 stars 89 forks source link

chore(analytics): add ownerType to homeView section definition #6026

Closed dblandin closed 1 month ago

dblandin commented 1 month ago

chore(analytics): add ownerType to homeView section definition

Section Definitions

A section can request viewAll behavior by providing explicit href and ownerType values in component > behaviors > viewAll:

{
  component: {
    behaviors: {
      viewAll: {
        buttonText: "View All Artworks",
        href: "/collection/:slug",
        ownerType: "collection
      }
    }
  }
}

A section can also request viewAll behavior without providing these explicit values. This lets the client fulfill the viewAll behavior. If the client provides a separate screen, it can use the section's pageOwner value for analytics:

{
  component: {
    behaviors: {
      viewAll: {
        buttonText: "View All Artworks",
      }
    }
  },
  pageOwner: "recentlyViewed"
}

Example Analytics Event Payloads

1) Tapped on an artwork from the "Recently Viewed" rail

{
  action: "tappedArtworkGroup",
  context_module: "recentlyViewedRail",
  context_screen_owner_type: "home",
  destination_screen_owner_id: "527ac4a0cd530e258d0000d0",
  destination_screen_owner_slug: "example-slug",
  destination_screen_owner_type: "artwork",
  horizontal_slide_position: 1,
  module_height: "double",
  type: "thumbnail",
}

2) Tapped on a viewAll trigger from the "Recently Viewed" rail

{
  action: "tappedArtworkGroup",
  context_module: "recentlyViewedRail",
  context_screen_owner_type: "home",
  destination_screen_owner_type: "recentlyViewed",
  type: "viewAll",
}

3) Screen event after triggering viewAll behavior from the "Recently Viewed" rail

{
  action: "screen",
  context_screen_owner_type: "recentlyViewed"
}