1.0 - 8.00 - Sessionize Example - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

Input

The input table, adweb_clickstream, contains web clickstream data recorded as a user navigates through a web site. Events—view, click, and so on—are recorded with a timestamp.

adweb_clickstream
userid adid productid event clicktime
1039 2 1001 view 2009-04-21 13:17:59
1039 2 1001 view 2009-04-21 13:17:59
1039 2 1001 view 2009-04-21 13:17:59
1039 3 1001 view 2009-05-23 13:17:59
1039 3 1001 view 2009-05-23 13:17:59
1039 3 1001 view 2009-05-23 13:17:59
1039 4 1001 view 2009-07-16 11:17:59
1039 4 1001 view 2009-07-16 11:17:59
1039 4 1001 view 2009-07-16 11:17:59
1039 4 1001 click 2009-07-16 11:18:16
1039 4 1001 click 2009-07-16 11:18:16
1039 4 1001 click 2009-07-16 11:18:16
1039 4 1001 landing_page 2009-07-16 11:18:18
1039 4 1001 landing_page 2009-07-16 11:18:18
1039 4 1001 landing_page 2009-07-16 11:18:18
... ... ... ... ...

SQL Call

SELECT * FROM Sessionize@coprocessor (
  ON adweb_clickstream PARTITION BY userid ORDER BY clicktime
  USING
  TimeColumn ('clicktime')
  TimeOut (60)
  ClickLag (0.2)
) AS dt;

Output

userid adid productid event clicktime sessionid clicklag
1039 2 1001 view 2009-04-21 13:17:59 0 f
1039 2 1001 view 2009-04-21 13:17:59 0 t
1039 2 1001 view 2009-04-21 13:17:59 0 t
1039 3 1001 view 2009-05-23 13:17:59 1 f
1039 3 1001 view 2009-05-23 13:17:59 1 t
1039 3 1001 view 2009-05-23 13:17:59 1 t
1039 4 1001 view 2009-07-16 11:17:59 2 f
1039 4 1001 view 2009-07-16 11:17:59 2 t
1039 4 1001 view 2009-07-16 11:17:59 2 t
1039 4 1001 click 2009-07-16 11:18:16 2 f
1039 4 1001 click 2009-07-16 11:18:16 2 t
1039 4 1001 click 2009-07-16 11:18:16 2 t
1039 4 1001 landing_page 2009-07-16 11:18:18 2 f
1039 4 1001 landing_page 2009-07-16 11:18:18 2 t
1039 4 1001 landing_page 2009-07-16 11:18:18 2 t
1039 1 1001 view 2009-07-29 20:17:59 3 f
1039 1 1001 view 2009-07-29 20:17:59 3 t
1039 1 1001 view 2009-07-29 20:17:59 3 t
1039 5 1001 view 2009-08-19 22:17:59 4 f
1039 5 1001 view 2009-08-19 22:17:59 4 t
1039 5 1001 view 2009-08-19 22:17:59 4 t
1039 5 1001 click 2009-08-19 22:18:02 4 f
1039 5 1001 click 2009-08-19 22:18:02 4 t
1039 5 1001 click 2009-08-19 22:18:02 4 t
... ... ... ... ... ... ...