I have a webservice writen in php and it is called from an desktop application installed on PC's. I want to have a register of the users who calls the functions on the web service and for this I only want to send hits to Google Analytics.
webservice in php:
<?php
require_once('lib/nusoap.php'); // basic include.. must go at the top
$SERVICE_NAMESPACE = "urn:Service"; // create a namespace to run under.
$server = new soap_server(); // the soap object from the include above.
// this has many input parameters but we only need two: the service name and the namespace
$server->configureWSDL('Service', $SERVICE_NAMESPACE);
$server->register('test',// method name
array('name' => 'xsd:string', 'name99' => 'xsd:string'),// input parameter called name.. and it's a string.
array('return' => 'xsd:string'),// output - one string is returned called "return"
$SERVICE_NAMESPACE,// namespace
$SERVICE_NAMESPACE . '#hello1',// soapaction
'rpc',// style.. remote procedure call
'encoded',// use of the call
'Nada interesante'// documentation for people who hook into your service.
);
function test($sName,$sName99)
{
return 'TEST ';
}
//This processes the request and returns a result.
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
I want to have google analytics info and for that i want to integrate the following script:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-89356985-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('config', 'UA-89356985-1');
</script>
I don't know how to integrate in the test function. I want to know when the users calls the test function.
Thanks in advance very much.