Import/Export API

Important: Read the introduction before proceeding.

Simple Import API

The Import API allows importing a visit into woopra. The visit data will be directly available in reporting, visitor profiles, schemas, labels…

Details

As described in the HTTP tracking API, events can be pushed into woopra with custom timestamps, simply by adding a unix timestamp (in Milliseconds) to the tracking request.

Example:


http://www.woopra.com/track/ce/
 
?host=mywebsite.com
&id=john@mail.com
&response=json
&cookie=AH47DHS5SF182DIQZJD
&timeout=300000
&cv_username=John+Smith
&cv_email=john@mail.com
&event=purchase
&ce_amount=149.95 
&timestamp=1381968226977

Important:

  • The imported data will be permanently written to the system, and the operation cannot be rolled back.

Bulk Import API

Details

The Bulk Import API allows importing a list of visits into Woopra in a single transaction.

Endpoint

https://www.woopra.com/rest/2.4/logs/import

Parameters

Name Description
website The project name as registered in Woopra
url The data file public location – any http or https hosted file can be used.

The url file should line-separated JSON visits (sessions), each session should have a visitor object and an array of actions. ex:

{"visitor":{"email":"test1@mail.com"}, "actions":[{"time":1444077951001, "name":"purchase", "properties":{"price":20, "currency":"$"}]}
{"visitor":{"email":"test2@mail.com", "username": "test2"}, "actions":[{"time":1444077951891, "name":"signup", "properties":{"campaign": true}]}
...

Example (command line):

curl --user appID:secretKey 'https://www.woopra.com/rest/2.4/logs/import?website=mybusiness.com&url=http://mysite.com/files/2015-02-01.log'

Important:

  • The imported data will be permanently written to the system, and the operation cannot be rolled back.

Export API

Exports the raw list of visits.

Endpoint

https://www.woopra.com/rest/2.4/logs/export

Parameters

Name Description
website The project name as registered in Woopra
file The log file name – this is also the PST date of the log file having the format yyyy-MM-dd. Ex: 2015-02-01 is the log file for Feb 1st, 2015. Log files are rotated at midnight PST. It is a good practice to send an http HEAD request to the same endpoint to get the current log file name.
pos (Advanced) Used for paging; The position of the log file cursor, required when file is today’s PST date.

Example (command line):

curl --user appID:secretKey 'https://www.woopra.com/rest/2.4/logs/export?website=mybusiness.com&file=2015-02-01&pos=0' > two-days-ago.log

Example (browser):

https://www.woopra.com/rest/2.4/logs/export
?website=mybusiness.com
&file=2015-02-01
&pos=0

Output:

{"date":"2014-03-20","country":"US","os":"Win","city":"Los Angeles","ip":"99.141.29.9","language":"English","pid":"rpE...
{"date":"2014-03-20","country":"UK","os":"Win","city":"London","ip":"99.188.29.9","language":"English","pid":"nXe...
{"date":"2014-03-20","country":"US","os":"Mac","city":"San Francisco","ip":"101.11.9.18","language":"English","pid":"nTu...
...

Streaming logs (Paging)

It is possible to stream logs by keeping track of the log file and pos of the export requests. The value of the next file and pos parameters are retrieved by reading the http Headers X-Woopra-NextFile and X-Woopra-NextPos from the previous Http request.

Important

The JSON parser should be able to process inserts and deletes. When a visitor is deleted, the visit log will have the following properties:

  • type: system
  • method: delete

It should be handled by deleting the visitor and their previous visits with the profile ID (pid).

Do you know what your customers are doing?
Find out in 5 minutes.

Try Woopra for free. No credit cards. No obligations.

Start for free