Can't get 'ua'(user agent) and 'ctype'(connection type) in pv/pp/


#1

Use version: sp.js 2.6.2.
I don’t know why I can’t get ‘ua’ and ‘ctype’ from pageview.
Who can tell me how to get them? Thank you.

I can get:

[string]

stm=1473829892389&e=pp&url=http%3A%2F%2F115.28.237.25%3A8089%2Fhome&page=%E9%A6&refr=http%3A%2F%2F115.28.237.25%3A8089%2Fhome&pp_mix=0&pp_max=0&pp_miy=0&pp_may=0&tv=js-2.6.1&tna=cf&p=web&tz=Asia%2FShanghai&lang=zh-CN&cs=UTF-8&f_pdf=1&f_qt=0&f_realp=0&f_wma=0&f_dir=0&f_fla=1&f_java=0&f_gears=0&f_ag=0&res=1920x1080&cd=24&cookie=1&eid=4c5811cf-5f78-43ff-8321-eb21706e7c35&dtm=1473829892386&vp=1875x187&ds=1860x2651&vid=4&sid=65843436-8ec3-4881-b214-40538af328f6&duid=49f06eb1-f934-4190-855f-8bbcd57254b6&fp=2505249248

[formatted]

stm=1473816452246
e=pv
url=******
refr=*******
tv=js-2.6.2
tna=cf
aid=CFe23a
p=mob
tz=Asia/Shanghai
lang=zh-cn
cs=UTF-8
res=320x568
cd=32
cookie=1
eid=3d4bdf51-4a77-465f-9685-cd908badf03d
dtm=1473816452240
vp=980x1409
ds=1210x1409
vid=1
sid=a313546f-d8f3-4ed1-9ecb-6563581e28b0
duid=dbbdc496-521e-4b53-a655-466c0663167c
fp=943216764
uid=alex+123


#2

Hello @YuxinChou,

Supposed way to extract User Agent is through enrichment process. You can see ua in snowplow tracker protocol just because it is used by our server-side trackers - their correct UserAgent HTTP header would be something like snowplow-python-tracker 0.7.0 (obviously useless for analytics), therefore server-side tracker needs to first extract user’s UA and then send it using ua parameter, whereas in JavaScript tracker there’s no such need - tracker’s UA is always the same as user’s and sent using UserAgent HTTP header.

You can checkout our ua-parser and user agent utils enrichments to extract information about users’ browsers.

Almost same for connection type. JavaScript tracker simply cannot determine it and you can see it in tracker protocol just because it is reserved (I believe so) and therefore marked as not implemented. Supposed way to get it is through IP Lookup enrichment, which can determine user’s connection (DSL/Dialup/etc) based on his IP.


#3

Thank you @anton,

I know there is a UserAgent in HTTP header. I want to collect user interaction data in Amazon Kinesis, and then analysis. If JavaScript tracker don’t return ‘ua’ to me, can I have ways to get it through HTTP header in enrichment process?

About connection type , I have seen marked as not implemented. No other question about connection type.


#4

Hey @YuxinChou! If understand your question correct - you need a Stream Enrich (instead of batch process which I linked above) it can enrich stream of events with either ua-parser or user agent utils enrichments same as in batch and write result to configured Kinesis Stream.

If for some reasons you need raw UserAgent header - you can use HTTP header extractor enrichment, but I highly recommend you to use specialized enrichments for this purpose.

Hope this helps.