Parameter _id not transmitted on HTTP API


#1

Hi,

I’m transmitting tracking data by calling the HTTP API (Tracking HTTP API: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3). But it seems the parameter _id won’t be received / stored, because I can’t find the values anywhere in the database.
As a result, it seem the unique page count doesn’t work correctly.

Additional Info: I’, using the parameter uid as well (if this has an influence to the behavior of Piwik).

Does anybody know how to find the value or has experiences in using the HTTP API?

Thanks
Joachim


(Matthieu Aubry) #2

Hi there,

_id will be stored in the visitor_id column. To read this column you need a little trick, see: How do I select IP addresses or Visitor ID directly from the database? - Analytics Platform - Matomo


#3

Hi Matt,

thanks a lot, I’ve tried already this FAQ, but it doesn’t help.

I’m using the following test app:


<html>

<head>
    <title>Make Piwik URL</title>
	
	<style>
		body {font-family:Arial; font-size:12px;}
		input  {font-family:Arial; font-size:14px;}
		select  {font-family:Arial; font-size:14px;}
	</style>
</head>

<body>
    <form action="piwik.php" method="post">
        <input type="hidden" name="rec" value="1" />
        <input type="hidden" name="apiv" value="1" />
        <table>
            <tr>
                <td><span title="idsite">Site ID</span></span></td>
                <td><input type="text" name="idsite" value="1" /></td>
            </tr>
            <tr>
                <td><span title="url">URL</span></td>
                <td><input type="text" size="64" name="url" /></td>
            </tr>
            <tr>
                <td><span title="action_name">Action Name</span></td>
                <td><input type="text" size="64" name="action_name" value="" /></td>
            </tr>
			<tr>
				<td><span title="">New Visit</span></td>
				<td>
					<select name="new_visit">
						<option value="">No</option>
						<option value="1">Yes</option>
					</select>
				</td>
			</tr>
            <tr>
                <td><span title="_id">Unique visitor ID</span></td>
                <td><input type="text" name="_id" value="1234567890123456" /></td>
            </tr>
            <tr>
                <td><span title="uid">User ID</span></td>
                <td><input type="text" name="uid" value="" /></td>
            </tr>
            <tr>
                <td><span title="">Random String</span></td>
                <td><input type="text" id="rand" name="rand" value="<?php echo mt_rand(); ?>" /></td>
            </tr>
            <tr>
                <td><span title="urlref">URL Referenz</span></td>
                <td><input type="text" name="urlref" /></td>
            </tr>
            <tr>
                <td><span title="ua">User-Agent</span></td>
                <td>
				<select name="ua" size="1">
					<option value="Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36">Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36</option>
					<option value="Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0">Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0</option>
					<option value="Mozilla/4.0 (Compatible; MSIE 8.0; Windows NT 5.2; Trident/6.0)">Mozilla/4.0 (Compatible; MSIE 8.0; Windows NT 5.2; Trident/6.0)</option>
					<option value="Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko">Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko</option>
					<option value="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/4.0; InfoPath.2; SV1; .NET CLR 2.0.50727; WOW64)">Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/4.0; InfoPath.2; SV1; .NET CLR 2.0.50727; WOW64)</option>
					<option value="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A">Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A</option>
					<option value="Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25">Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25</option>
				</select>
				</td>
            </tr>
            <tr>
                <td><span title="lang">Language</span></td>
                <td>
				<select name="lang" size="1">
					<option value="de-de">de-de</option>
					<option value="de-CH">de-CH</option>
					<option value="en-US">en-US</option>
					<option value="en-gb">en-gb</option>
					<option value="fr-fr">fr-fr</option>
				</select>
				</td>
            </tr>
            <tr>
                <td><span title="res">Screen Resolution</span></td>
                <td><input type="text" name="res" value="720x348" /></td>
            </tr>
            <tr>
                <td><span title="_cvar">Custom Variables</span></td>
                <td><input type="text" size="128" name="_cvar" value='{"1":["OS","iphone 5.0"],"2":["Piwik Mobile Version","1.6.2"],"3":["Locale","en::en"],"4":["Num Accounts","2"]}' /></td>
            </tr>
            <tr>
                <td><span title="_rcn / _rck">Kampagne & Keyword</span></td>
                <td><input type="text" name="_rcn" />&nbsp;&nbsp;&nbsp;<input type="text" name="_rck" /></td>
            </tr>
            <tr>
                <td><span title="h / m / s">Lokale Zeit</span></td>
                <td><input type="number" name="h" min="0" max="23" /> : <input type="number" name="m" min="0" max="59" /> : <input type="number" name="s" min="0" max="59" /></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="text" name="" /></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="text" name="" /></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="text" name="" /></td>
            </tr>
        </table>
        <input type="submit" />
    </form>
</body>

</html>

With the default value “1234567890123456” I get back the value “5810530285998559301” as result this select statement for the column visitorid.

Thanks
Joachim