def pageLevelTargetingForContentPage()

in src/main/scala/com/gu/commercial/display/AdTargeter.scala [14:59]


  def pageLevelTargetingForContentPage(editionId: String, renderingPlatform: Option[RenderingPlatformParam] = None)(item: Content): Set[AdTargetParam] =
    Set(
      AuthorParam.from(item),
      BlogParam.from(item),
      BrandingParam.from(item, editionId),
      ContentTypeParam.from(item),
      EditionParam.from(editionId),
      KeywordParam.from(item),
      ObserverParam.from(item),
      PathParam.from(item),
      Some(PlatformParam(platform)),
      renderingPlatform,
      SeriesParam.from(item),
      ShortUrlParam.from(item),
      SurgeLevelParam.from(item, surgeLookupService),
      ToneParam.from(item)
    ).flatten

  def pageLevelTargetingForSectionFront(editionId: String)(section: Section): Set[AdTargetParam] =
    Set(
      BrandingParam.from(section, editionId),
      Some(ContentTypeParam("section")),
      EditionParam.from(editionId),
      KeywordParam.from(section),
      PathParam.from(section),
      Some(PlatformParam(platform))
    ).flatten

  def pageLevelTargetingForTagPage(editionId: String)(tag: Tag): Set[AdTargetParam] = {

    val tagParam =
      KeywordParam.from(tag) orElse
        SeriesParam.from(tag) orElse
        ToneParam.from(tag) orElse
        AuthorParam.from(tag) orElse
        BlogParam.from(tag)

    Set(
      tagParam,
      BrandingParam.from(tag, editionId),
      Some(ContentTypeParam("tag")),
      EditionParam.from(editionId),
      PathParam.from(tag),
      Some(PlatformParam(platform))
    ).flatten
  }