ParselyiOS  2.2
The Parsely iOS Toolkit
 All Classes Functions Variables Typedefs Enumerations Properties Pages
Public Types | Instance Methods | Class Methods | Public Attributes | Properties | List of all members
ParselyTracker Class Reference

Manages pageview events and analytics data for Parsely on iOS. More...

#import <ParselyTracker.h>

Inheritance diagram for ParselyTracker:

Public Types

enum  _kIdType { kUrl, kPostId }
 types of post identifiers More...
 
typedef enum
ParselyTracker::_kIdType 
kIdType
 types of post identifiers More...
 

Instance Methods

(void) - trackURL:
 Register a pageview event using a canonical URL. More...
 
(void) - trackPostID:
 Register a pageview event using a CMS post identifier. More...
 
(void) - track:withIDType:
 Registers a pageview event. More...
 
(void) - flush
 Generate pixel requests from the queue. More...
 
(void) - stopFlushTimer
 Disallow Parsely from sending pageview events. More...
 
(void) - setFlushTimer
 Allow Parsely to send pageview events. More...
 
(id) - initWithApiKey:andFlushInterval:andUrlref:
 Singleton constructor. More...
 
(void) - sendBatchRequest:
 Send the entire queue as a single request. More...
 
(NSInteger) - queueSize
 Get the size of the queue. More...
 
(NSInteger) - storedEventsCount
 Get the size of the persistent store. More...
 
(BOOL) - flushTimerIsActive
 Is the callback timer running. More...
 

Class Methods

(ParselyTracker *) + sharedInstance
 Singleton instance accessor. More...
 
(ParselyTracker *) + sharedInstanceWithApiKey:andFlushInterval:
 Singleton instance factory. More...
 
(ParselyTracker *) + sharedInstanceWithApiKey:andFlushInterval:andUrlref:
 Singleton instance factory. More...
 
(ParselyTracker *) + sharedInstanceWithApiKey:
 Singleton instance factory. More...
 

Public Attributes

NSInteger storageSizeLimit
 
NSInteger queueSizeLimit
 

Properties

NSString * apiKey
 
NSString * urlref
 
NSInteger flushInterval
 
BOOL shouldFlushOnBackground
 

Detailed Description

Manages pageview events and analytics data for Parsely on iOS.

Accessed as a singleton. Maintains a queue of pageview events in memory and periodically flushes the queue to the Parsely pixel proxy server.

Member Typedef Documentation

- (typedef enum _kIdType) ParselyTracker:

types of post identifiers

Representation of the allowed post identifier types

Member Enumeration Documentation

- (enum) _kIdType

types of post identifiers

Representation of the allowed post identifier types

Method Documentation

- (void) flush

Generate pixel requests from the queue.

Empties the entire queue and sends the appropriate pixel requests. If shouldBatchRequests is YES, the queue is sent as a minimum number of requests. Called automatically after a number of seconds determined by flushInterval.

- (BOOL) flushTimerIsActive

Is the callback timer running.

Returns
YES if the callback timer is currently running, NO otherwise
- (id) initWithApiKey: (NSString *)  apikey
andFlushInterval: (NSInteger)  flushint
andUrlref: (NSString *)  urlref_ 

Singleton constructor.

Creates an instance of the class and returns the reference. Prefer sharedInstanceWithApiKey: to this method.

Parameters
apikeyParsely public API key (eg "samplesite.com")
flushintInterval between queue flushes, expressed in seconds
urlref_The urlref value to send with each event
Returns
The singleton instance
- (NSInteger) queueSize

Get the size of the queue.

Returns
The current cardinality of the in-memory event queue
- (void) sendBatchRequest: (NSSet *)  queue

Send the entire queue as a single request.

Creates a large POST request containing the JSON encoding of the entire queue. Sends this request to the proxy server, which forwards requests to the pixel server.

Parameters
queueThe list of event dictionaries to serialize
Returns
The HTTP request error encountered during the send, if any
- (void) setFlushTimer

Allow Parsely to send pageview events.

Instantiates the callback timer responsible for flushing the events queue. Can be called before of after stop, but has no effect is used before instantiating the singleton

+ (ParselyTracker *) sharedInstance

Singleton instance accessor.

Note: This must be called after sharedInstanceWithApiKey:

Returns
The singleton instance
+ (ParselyTracker *) sharedInstanceWithApiKey: (NSString *)  apikey

Singleton instance factory.

Note: This must be called before sharedInstance

Parameters
apikeyThe Parsely public API key (eg "samplesite.com")
Returns
The singleton instance
+ (ParselyTracker *) sharedInstanceWithApiKey: (NSString *)  apikey
andFlushInterval: (NSInteger)  flushint 

Singleton instance factory.

Note: This must be called before sharedInstance

Parameters
apikeyThe Parsely public API key (eg "samplesite.com")
flushintInterval between queue flushes, expressed in seconds
Returns
The singleton instance
+ (ParselyTracker *) sharedInstanceWithApiKey: (NSString *)  apikey
andFlushInterval: (NSInteger)  flushint
andUrlref: (NSString *)  urlref_ 

Singleton instance factory.

Note: This must be called before sharedInstance

Parameters
apikeyThe Parsely public API key (eg "samplesite.com")
flushintInterval between queue flushes, expressed in seconds
urlref_The urlref value to send with each event
Returns
The singleton instance
- (void) stopFlushTimer

Disallow Parsely from sending pageview events.

Invalidates the callback timer responsible for flushing the events queue. Can be called before or after start, but has no effect if used before instantiating the singleton

- (NSInteger) storedEventsCount

Get the size of the persistent store.

Returns
The current number of events stored in persistent memory (the defaults store)
- (void) track: (NSString *)  identifier
withIDType: (kIdType idtype 

Registers a pageview event.

Places a data structure representing the event into the in-memory queue for later use

Note: Events placed into this queue will be discarded if the size of the persistent queue store exceeds storageSizeLimit.

- (void) trackPostID: (NSString *)  postid

Register a pageview event using a CMS post identifier.

Parameters
postidA string uniquely identifying this post. This must be unique within Parsely's database.
- (void) trackURL: (NSString *)  url

Register a pageview event using a canonical URL.

Parameters
urlThe canonical URL of the article being tracked (eg: "http://samplesite.com/some-old/article.html")

Member Data Documentation

- (NSInteger) queueSizeLimit

Maximum number of events held in the in-memory event queue

- (NSInteger) storageSizeLimit

Maximum number of events held in persistent storage

Property Documentation

- (NSString*) apiKey
readwritenonatomicassign

Parsely public API key (eg "samplesite.com")

- (NSInteger) flushInterval
readwritenonatomicassign

The time between event queue flushes expressed in seconds

- (BOOL) shouldFlushOnBackground
readwritenonatomicassign

If YES, the event queue is automatically flushed when the app enters the background

- (NSString*) urlref
readwritenonatomicassign

The "urlref" value sent with each event. Defaults to "parsely_mobile_sdk"


The documentation for this class was generated from the following files: