Still struggling a bit with the FeatureLayerManager class and when to use add_to_defintion, updateDefinition or delete_from_definition.
This time, I am trying to enable editing and editor tracking on a hosted feature service. I started by opening up the Chrome developer tools Network monitor, then on the Feature Layer settings page I manually checked the options 'Enable editing', 'Keep track of created and updated features' and 'Keep track of who created and last updated features', then hit Save. I then saw the console send an update_definition request.

I copied the form data and popped that into my update_definition method in my python notebook @ line 13
# Convert to a Spatially Enabled Dataframe
sdf = pd.DataFrame.spatial.from_xy(df, "lon_y", "lat_x", sr=4326)
print('Publishing layer...')
item = sdf.spatial.to_featurelayer('myFeatureLayer', tags=["test"], folder="My Folder")
print("Deleting interim fGDB...")
interimGDB = gis.content.get(gis.content.search(query="title:myFeatureLayer", item_type="File Geodatabase")[0].id).delete()
featureLayer = gis.content.get(item.id).layers[0]
print("Enabling Change Tracking...")
resp = featureLayer.manager.update_definition({
"hasStaticData":False,
"capabilities": "Query, Editing, Create, Update, Delete, ChangeTracking",
"editorTrackingInfo":{
"enableEditorTracking":True,
"enableOwnershipAccessControl":False,
"allowOthersToUpdate":True,
"allowOthersToDelete":True,
"allowOthersToQuery":True,
"allowAnonymousToUpdate":True,
"allowAnonymousToDelete":True}
})
print(resp)
print(featureLayer.properties)
Reviewing the properties/definition however, I noticed that under nothing in the definition actually was updated, other than 'hasStaticData' which was changed from False to True. 'ChangeTracking' is not listed as a capability and the editorTrackingInfo array is not present in the updated definition.