I'm having problems updating the exitEvents of a creative in Google DisplayVideo. I'm able to update all other properties of a creative, except for exitEvents.
Environment details
- OS: macOS Venture 13.1
- PHP version: 7.4.33
- Package name and version: "google/apiclient": "^v2.13.0" & "googleads/googleads-php-lib": "v59.0.0" (Also issue on my last setup: "google/apiclient": "^2.12.6" & "googleads/googleads-php-lib": "^49.0.0")
Steps to reproduce
- Use the code snippet below, I would expect the exitEvents to update
Code example
use Google_Client;
use Google_Service_DisplayVideo;
use Google_Service_DisplayVideo_Creative;
use Google_Service_DisplayVideo_Dimensions;
use Google_Service_DisplayVideo_ExitEvent;
$client = new Google_Client();
$client->setApplicationName('Example app');
$client->addScope('https://www.googleapis.com/auth/display-video');
$client->setAuthConfig(YOUR_OWN);
$service = new Google_Service_DisplayVideo($client);
$creative = new Google_Service_DisplayVideo_Creative();
$creative->setDisplayName('This is a banner');
$creative->setEntityStatus('ENTITY_STATUS_ACTIVE');
$creative->setHostingSource('HOSTING_SOURCE_THIRD_PARTY');
$creative->setCreativeType('CREATIVE_TYPE_STANDARD');
$creative->setRequireMraid(false);
$creative->setRequireHtml5(false);
$creative->setRequirePingForAttribution(false);
$creative->setNotes('These are notes');
$creative->setThirdPartyTag('<script></script>');
$dimensions = new Google_Service_DisplayVideo_Dimensions();
$dimensions->setWidthPixels(1);
$dimensions->setHeightPixels(1);
$creative->setDimensions($dimensions);
$exitEvent = new Google_Service_DisplayVideo_ExitEvent();
$exitEvent->setType('EXIT_EVENT_TYPE_DEFAULT');
$exitEvent->setUrl('https://google.com');
$creative->setExitEvents([$exitEvent]);
// exitEvents is now
#+exitEvents: array:1 [
# 0 => Google\Service\DisplayVideo\ExitEvent {#5321
# +name: null
# +reportingName: null
# +type: "EXIT_EVENT_TYPE_DEFAULT"
# +url: "https://google.com"
# #internal_gapi_mappings: []
# #modelData: []
# #processed: []
# }
# ]
$result = $service->advertisers_creatives->create(
YOUR_OWN,
$creative
);
// exitEvents is now
#+exitEvents: array:1 [
# 0 => Google\Service\DisplayVideo\ExitEvent {#5290
# +name: null
# +reportingName: null
# +type: "EXIT_EVENT_TYPE_BACKUP"
# +url: "https://google.com"
# #internal_gapi_mappings: []
# #modelData: []
# #processed: []
# }
# ]
$result->setDisplayName('This is a banner with new exitEvent');
$exitEventNew = new Google_Service_DisplayVideo_ExitEvent();
$exitEventNew->setType('EXIT_EVENT_TYPE_DEFAULT');
$exitEventNew->setUrl('https://newsite.com');
$result->setExitEvents([$exitEventNew]);
#+exitEvents: array:1 [
# 0 => Google\Service\DisplayVideo\ExitEvent {#5234
# +name: null
# +reportingName: null
# +type: "EXIT_EVENT_TYPE_DEFAULT"
# +url: "https://newsite.com"
# #internal_gapi_mappings: []
# #modelData: []
# #processed: []
# }
]
$result = $service->advertisers_creatives->patch(
YOUR_OWN,
$result->getCreativeId(),
$result,
[
'updateMask' => 'displayName,exitEvents'
]
);
// exitEvents is still the old value while DisplayName has been updated
#+exitEvents: array:1 [
# 0 => Google\Service\DisplayVideo\ExitEvent {#5290
# +name: null
# +reportingName: null
# +type: "EXIT_EVENT_TYPE_BACKUP"
# +url: "https://google.com"
# #internal_gapi_mappings: []
# #modelData: []
# #processed: []
# }
# ]
Even if I would do things differently I can change every value except the exitEvents
$creative = $service->advertisers_creatives->get(
YOUR_OWN,
YOUR_OWN
);
$events = $creative->getExitEvents();
$events[0]->setUrl('https://newsite.com');
$creative->setExitEvents($events);
$result = $service->advertisers_creatives->patch(
YOUR_OWN,
$creative->getCreativeId(),
$creative,
[
'updateMask' => 'displayName,exitEvents'
]
);
I have also played around with exitEvents.url, exitevents, exit_events
and so on.
It seems like updateMask
doesn't except exitEvents
since $creative->setExitEvents([]);
would in my eyes result in an error (since it's required) but it doesn't provide an error.
Am I doing something wrong, or is there a bug?