Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional page_type parameter to ParselyMetadata class in iOS SDK #90

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
9 changes: 8 additions & 1 deletion Sources/Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class ParselyMetadata {
var section: String?
var tags: Array<String>?
var duration: TimeInterval?
var page_type: String?

/**
A class to manage and re-use metadata. Metadata contained in an instance of this
Expand All @@ -22,6 +23,7 @@ public class ParselyMetadata {
- Parameter section: Same as section for website integration.
- Parameter tags: Up to 20 tags on an event are allowed.
- Parameter duration: Durations passed explicitly to trackVideoStart take precedence over any in metadata.
- Parameter page_type: The type of page being tracked
*/
public init(canonical_url: String? = nil,
pub_date: Date? = nil,
Expand All @@ -30,7 +32,8 @@ public class ParselyMetadata {
image_url: String? = nil,
section: String? = nil,
tags: Array<String>? = nil,
duration: TimeInterval? = nil) {
duration: TimeInterval? = nil,
page_type: String? = nil) {
self.canonical_url = canonical_url
self.pub_date = pub_date
self.title = title
Expand All @@ -39,6 +42,7 @@ public class ParselyMetadata {
self.section = section
self.tags = tags
self.duration = duration
self.page_type = page_type
}

func toDict() -> Dictionary<String, Any> {
Expand Down Expand Up @@ -68,6 +72,9 @@ public class ParselyMetadata {
if let duration {
metas["duration"] = duration
}
if let page_type {
metas["page_type"] = page_type
}

return metas
}
Expand Down