Class
EventProperties
@objc(PermutiveEventProperties)
public final class EventProperties: NSObject
EventProperties describes metadata to be attached to a tracked event.
Only certain types of information can be attached as metadata to an event.
Important
EventProperties instances should be initialised in reference to a particular
event type. The key names and value types must match exactly the schema defined
for that particular event in the Permutive dashboard. Incorrect or additional
entries will result in the event being rejected by the Permutive API.
Enrichment
Metadata can be enriched with current geolocation, ISP and (hashed) IP address
information. To achieve this add an entry whose key value matches that defined
in the event schema and set the value to EventProperties.geoInfoValue,
EventProperties.ispInfoValue or EventProperties.ipHashInfoValue. The
Permutive SDK will substitute the current values for respective placeholder
when tracking an event.
E.g.
let properties = EventProperties(["my_event_geolocation_key": EventProperties.geoInfoValue])
try Permutive.shared.track(event: "Pageview", properties: properties)
Relationships
Conforms To
NSObject
Initializers
init()
@objc
override public init()
init(_:)
@objc
public init(_ properties: [String: AnyHashable]) throws
EventProperties is used to encapsulate event metadata to be included with an event. Values must be supported types or an exception will be thrown.
Parameters
| Name | Type | Description |
|---|---|---|
| properties | [String: AnyHashable] |
A [String: AnyHashable] |
Throws
Throws an SDKError with message: "contains invalid types. Supported types are Int, Bool, Float, Double, String, Date, EventProperties, and arrays of these types"
Properties
geoInfoValue
@objc public static let geoInfoValue = "$ip_geo_info"
A value denoting geo location information, if available
ispInfoValue
@objc public static let ispInfoValue = "$ip_isp_info"
A value denoting ISP information, if available
ipHashInfoValue
@objc public static let ipHashInfoValue = "$ip_address_hash"
A value denoting the current external IP address hash information, if available
alchemyConceptsValue
@objc public static let alchemyConceptsValue = "$alchemy_concepts"
Use this constant to enrich the event with the alchemy concepts of the current url
alchemyEntitiesValue
@objc public static let alchemyEntitiesValue = "$alchemy_entities"
Use this constant to enrich the event with the alchemy entities of the current url
alchemyKeywordsValue
@objc public static let alchemyKeywordsValue = "$alchemy_keywords"
Use this constant to enrich the event with the alchemy keywords of the current url
alchemyTaxonomyValue
@objc public static let alchemyTaxonomyValue = "$alchemy_taxonomy"
Use this constant to enrich the event with the alchemy taxonomy of the current url
alchemyDocumentEmotionValue
@objc public static let alchemyDocumentEmotionValue = "$alchemy_document_emotion"
Use this constant to enrich the event with the alchemy document emotion of the current url
alchemyDocumentSentimentValue
@objc public static let alchemyDocumentSentimentValue = "$alchemy_document_sentiment"
Use this constant to enrich the event with the alchemy document sentiment of the current url
alchemyTaxonomyLabelsValue
@objc public static let alchemyTaxonomyLabelsValue = "$alchemy_taxonomy_labels"
Use this constant to enrich the event with the alchemy taxonomy labels of the current url
alchemyEntityNamesValue
@objc public static let alchemyEntityNamesValue = "$alchemy_entity_names"
Use this constant to enrich the event with the alchemy entity names of the current url
description
override var description: String
debugDescription
override var debugDescription: String
Methods
object(forKey:)
func object(forKey key: String) -> AnyHashable?
Get object for key in EventProperties
Parameters
| Name | Type | Description |
|---|---|---|
| key | String |
The key for the object that need to be retrieved |
Returns
The object if it exist
set(number:forKey:)
func set(number: NSNumber, forKey key: String) throws
Set a number value for key
set(string:forKey:)
func set(string: String, forKey key: String) throws
Set a string value for key
set(properties:forKey:)
func set(properties: EventProperties, forKey key: String) throws
Set a properties value for key
set(bools:forKey:)
func set(bools: [Bool], forKey key: String) throws
Set a bool array value for key
set(numbers:forKey:)
func set(numbers: [NSNumber], forKey key: String) throws
Set a number array value for key
set(strings:forKey:)
func set(strings: [String], forKey key: String) throws
Set a string array value for key
set(dates:forKey:)
func set(dates: [Date], forKey key: String) throws
Set a dates array value for key
set(propertiesList:forKey:)
func set(propertiesList: [EventProperties], forKey key: String) throws
Set a propertiesList array value for key
asDictionary()
func asDictionary() -> [String: AnyHashable]
Return the EventProperties object as a Dictionary
Returns
Dictionary