Track view goal on iOS
I'm using Optimizely SDK on a native iOS application.
I created some custom goals and now I need some "View Goal".
I cannot find anything to track this kind of goal. The documentation  says
For more details and to learn about tap and view goals, refer to the following article from our Knowledge Base.
But the linked article is about web tracking and not about iOS.
If I try to add a ViewGoald directly from the editor, the list of views is empty.
Does someone have any advice?
Sorry about that link pointing to the wrong article. I believe the article that it should have linked to is one of these:
To set up a view goal, follow these steps:
- Put your app into Edit Mode and open the Editor for your experiment. This should connect your app to the Editor.
- Click the Goals button at the top right and choose "Create new goal".
- Change the Goal Type to "View"
- Navigate your app to the view that you want to track with this goal.
- You will see view selectors populate into the goal Editor as you navigate through your app.
- When your goal contains the view selector(s) for the view(s) you want to track, save your goal.
I'll update the documentation to be more descriptive about this process. Let me know if you have any questions.
I am sorry that you are having issues with our View Goal. To create a view goal, connect the iphone app and open up the editor. Tap on goals (the one with a flat on the top right). You can then create a saved goal.
Tap on saved goal and select the 'view' goal type. In order for the editor to register the view, you will have interact with the app in your connected device.
That means either navigate to a different view in the app and come back you want and you will see the view being registered.
See attached view
On the editor the list of the view didn't appear because I disabled the swizzling method on the iOS SDK:
Nevertheless, I cannot use the editor to configure my views, because in some case the "name" of the view depends on the context where this view is loaded.
I would like to be able to trigger a viewgoal manually, using something like
[Optimizely trackEventView:@"Edit profile page"];
Disabling swizzling also disables the ability to track view goals and tap goals. You must rely on custom event goals with swizzling disabled. You can track a custom event like so:
[Optimizely trackEvent@"custom event name"];
You can trigger this goal when a view loads by placing that code in the viewDidLoad method of your view controller.