diff --git a/parsely/src/main/java/com/parsely/parselyandroid/ParselyMetadata.kt b/parsely/src/main/java/com/parsely/parselyandroid/ParselyMetadata.kt index 8b551587..0314d2af 100644 --- a/parsely/src/main/java/com/parsely/parselyandroid/ParselyMetadata.kt +++ b/parsely/src/main/java/com/parsely/parselyandroid/ParselyMetadata.kt @@ -15,13 +15,14 @@ open class ParselyMetadata /** * Create a new ParselyMetadata object. * - * @param authors The names of the authors of the content. Up to 10 authors are accepted. - * @param link A post's canonical url. - * @param section The category or vertical to which this content belongs. - * @param tags User-defined tags for the content. Up to 20 are allowed. - * @param thumbUrl URL at which the main image for this content is located. - * @param title The title of the content. - * @param pubDate The date this piece of content was published. + * @param authors The names of the authors of the content. Up to 10 authors are accepted. + * @param link A post's canonical url. + * @param section The category or vertical to which this content belongs. + * @param tags User-defined tags for the content. Up to 20 are allowed. + * @param thumbUrl URL at which the main image for this content is located. + * @param title The title of the content. + * @param pubDate The date this piece of content was published. + * @param pageType The type of page being tracked */( private val authors: List? = null, @JvmField internal val link: String? = null, @@ -30,6 +31,7 @@ open class ParselyMetadata private val thumbUrl: String? = null, private val title: String? = null, private val pubDate: Calendar? = null + private val pageType: String? = null ) { /** * Turn this object into a Map @@ -59,6 +61,9 @@ open class ParselyMetadata if (pubDate != null) { output["pub_date_tmsp"] = pubDate.timeInMillis / 1000 } + if (pageType != null) { + output["page_type"] = pageType + } return output } } diff --git a/parsely/src/test/java/com/parsely/parselyandroid/ParselyMetadataTest.kt b/parsely/src/test/java/com/parsely/parselyandroid/ParselyMetadataTest.kt index 3bf8b61e..0af3c71f 100644 --- a/parsely/src/test/java/com/parsely/parselyandroid/ParselyMetadataTest.kt +++ b/parsely/src/test/java/com/parsely/parselyandroid/ParselyMetadataTest.kt @@ -17,7 +17,8 @@ class ParselyMetadataTest { tags, thumbUrl, title, - pubDate + pubDate, + pageType ) // when @@ -39,7 +40,8 @@ class ParselyMetadataTest { thumbUrl, title, pubDate, - duration + duration, + pageType ) // when @@ -57,6 +59,7 @@ class ParselyMetadataTest { val thumbUrl = "sample thumb url" val title = "sample title" val pubDate = Calendar.getInstance().apply { set(2023, 0, 1) } + val pageType = "post" val expectedParselyMetadataMap = mapOf( "authors" to authors, @@ -65,7 +68,8 @@ class ParselyMetadataTest { "tags" to tags, "thumb_url" to thumbUrl, "title" to title, - "pub_date_tmsp" to pubDate.timeInMillis / 1000 + "pub_date_tmsp" to pubDate.timeInMillis / 1000, + "page_type" to pageType ) } }