Kindly look the below URL
https://segment.com/docs/connections/sources/catalog/libraries/server/php/#analytics%20for%20php
Segment::track(array(
"userId" => "f4ca124298",
"event" => "Signed Up",
"properties" => array(
"plan" => "Enterprise"
)
));
I implemented the above code in
/var/www/html/exams/wp-content/themes/startertheme/functions.php
in wordpress directory but it is not working. Please help me.
Thanks,
Can confirm please:
After, You need to require the Segment.php file into your functions.php file.
require_once("/path/to/analytics-php/lib/Segment.php");
It is working fine now. Paste the below code Segment::flush();
in each function like below.
function login_event() {
Segment::track(array(
"userId" => "NO USER ID",
"event" => "Login event"
));
Segment::flush();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.