Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined Method setActionSource() #615

Open
asila96 opened this issue Oct 22, 2024 · 1 comment
Open

Undefined Method setActionSource() #615

asila96 opened this issue Oct 22, 2024 · 1 comment

Comments

@asila96
Copy link

asila96 commented Oct 22, 2024

I'm trying to set up an event request per the documentation and examples, but I'm getting an error when I try to use setActionSource(). Am I missing something or is this an actual bug?

use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;

use FacebookAds\Object\ServerSide\Content;
use FacebookAds\Object\ServerSide\CustomData;
use FacebookAds\Object\ServerSide\DeliveryCategory;
use FacebookAds\Object\ServerSide\Event;
use FacebookAds\Object\ServerSide\EventRequest;
use FacebookAds\Object\ServerSide\Gender;
use FacebookAds\Object\ServerSide\UserData;
use FacebookAds\Object\ServerSide\Util;

....

$event_0 = (new Event())
                          ->setEventName($eventName)
                          ->setEventTime(strtotime("now"))
                          ->setActionSource("Website") // throws errors for some reason
                          ->setUserData($user_data_0)
                          ->setCustomData($custom_data_0);

array_push($events, $event_0);
    
$request = (new EventRequest($pixel_id))
                                          ->setEvents($events);         

Error Message in PHP logs: Error: Call to undefined method FacebookAds\Object\ServerSide\Event::setActionSource()

@asila96
Copy link
Author

asila96 commented Oct 28, 2024

Update, I added the following to the top of my file as well:

use FacebookAds\Object\ServerSide\ActionSource;

But still no luck. I also get errors if I try using the "setEmails" or "setPhones" methods too - but I found that "setEmail" and "setPhone" work ok, which is fine since I won't have more than 1 value for each of those anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant