The "Track changes" state in oXygen can be controlled in several ways:
1. By the user, when pressing the "Toggle change tracking" button.
2. It may be saved in the document (check for a <?oxy_options track_changes="on"?>
processing instruction at the end of the document)
3. It is configured as an option (available in the Administration Page in Web Author 18.1).
I tried your code and it seems that:
- it changes the track changes state. It actually changes it three times. Maybe the initial state of the "Track changes" is not the one you expected.
- the toggled state of the button is not updated. Unfortunately there is currently no simple way to update the toggled state of a button. I will register an issue about that.
What you can do instead, if you want also the button state to be updated is to trigger synthetic mouse events on the button. I found this answer to work http://stackoverflow.com/a/24026594