 
 
 	@objc
-	private func parser(parser: NSXMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String]) {
+	private func parser(parser: NSXMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName: String?, attributes: [String : String]) {
 		currentString = ""
 		elementPath.append(elementName)
 
 		switch state {
 		case .automaticTracking:
-			// FIXME
-			pushState(.unknown)
+			switch (elementName) {
+			case "advertisingIdentifier": pushSimpleElement(automaticallyTracksAdvertisingId)        { value in self.automaticallyTracksAdvertisingId = self.parseBool(value) }
+			case "appName":               pushSimpleElement(automaticallyTracksAppName)              { value in self.automaticallyTracksAppName = self.parseBool(value) }
+			case "appUpdates":            pushSimpleElement(automaticallyTracksAppUpdates)           { value in self.automaticallyTracksAppUpdates = self.parseBool(value) }
+			case "appVersion":            pushSimpleElement(automaticallyTracksAppVersion)           { value in self.automaticallyTracksAppVersion = self.parseBool(value) }
+			case "connectionType":        pushSimpleElement(automaticallyTracksConnectionType)       { value in self.automaticallyTracksConnectionType = self.parseBool(value) }
+			case "eventQueueSize":        pushSimpleElement(automaticallyTracksEventQueueSize)       { value in self.automaticallyTracksEventQueueSize = self.parseBool(value) }
+			case "interfaceOrientation":  pushSimpleElement(automaticallyTracksInterfaceOrientation) { value in self.automaticallyTracksInterfaceOrientation = self.parseBool(value) }
+			case "pages":                 pushState(.automaticTrackingPages)
+
+			default:
+				warn(message: "unknown element")
+				pushState(.unknown)
+			}
+
+		case let .automaticTrackingPage(viewControllerTypeName):
+			switch (elementName) {
+			case "pageProperties":
+				if let name = attributes["name"]?.nonEmpty {
+					currentPageProperties = PageProperties(name: name)
+					pushState(.pageProperties(name: name))
+				}
+				else {
+					fail(message: "missing attribute 'name'")
+					pushState(.unknown)
+				}
+
+			default:
+				warn(message: "unknown element in page '\(viewControllerTypeName)'")
+				pushState(.unknown)
+			}
+
+		case .automaticTrackingPages:
+			if elementName == "page" {
+				if let viewControllerTypeName = attributes["viewControllerType"]?.nonEmpty {
+					let patternString: String?
+					if viewControllerTypeName.hasPrefix("/") {
+						if let _patternString = viewControllerTypeName.firstMatchForRegularExpression("^/(.*)/$")?[1] {
+							patternString = _patternString
+						}
+						else {
+							fail(message: "invalid regular expression: missing trailing slash")
+							patternString = nil
+						}
+					}
+					else {
+						patternString = "\\b\(NSRegularExpression.escapedPatternForString(viewControllerTypeName))\\b"
+					}
+
+					if let patternString = patternString {
+						let pattern: NSRegularExpression?
+						do {
+							pattern = try NSRegularExpression(pattern: patternString, options: [])
+						}
+						catch let error {
+							fail(message: "invalid regular expression: \(error)")
+							pattern = nil
+						}
+
+						if let pattern = pattern {
+							pushState(.automaticTrackingPage(viewControllerTypeName: viewControllerTypeName, viewControllerTypeNamePattern: pattern))
+						}
+					}
+				}
+				else {
+					fail(message: "missing attribute 'viewControllerType'")
+					pushState(.unknown)
+				}
+			}
+			else {
+				warn(message: "unknown element")
+				pushState(.unknown)
+			}
 
 		case .initial:
 			pushState(.root)
+
+		case let .pageProperties(name):
+			warn(message: "not yet implemented") // FIXME
+			pushState(.unknown)
 
 		case .root:
 			switch (elementName) {


	@objc
	private func parser(parser: NSXMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?) {
		switch state {
		case let .simpleElement(completion):
			completion(currentString)

		case .automaticTracking, .initial, .root, .unknown: // FIXME
			break
		}


			return
		}

		pushState(.simpleElement(completion: completion))
	}


