Tracking with Measurement Protocol

To collect the majority of user behavior events to BigQuery, OWOX BI, using either the customTask or analytics.js method, duplicates all the data Google Analytics collects from the website and sends it to the dedicated OWOX BI access point.

For collecting offline events or the events that happen after the user’s session on the website, Google Analytics offers using Measurement Protocol. The protocol can send any kind of user behavior data directly to Google Analytics using an HTTP request.

OWOX BI access point

If you send certain events to Google Analytics via Measurement Protocol, you need to duplicate them to the OWOX BI access point as well. The access point is https://google-analytics.bi.owox.com/UA-XXXXX-X, where UA-XXXXX-X — is your Google Analytics tracking ID.

Without duplicating the request, the event data won’t get to BigQuery, which will result in data discrepancy with Google Analytics. Please note that to send the data to Google Analytics, you still need to send a request to https://www.google-analytics.com/collect.

Sending requests

Sending requests to our access point is no different from sending them to Google Analytics: you send data as a POST or a GET request. See what the requests look like in Google documentation.

POST request (recommended method)

For a POST request, you need to specify payload data identical to the one you send to Google Analytics. Here’s an example:

v=1&cid=555&t=pageview&dp=%2Fhome.

For POST requests, use one of these Content-type headers:

  1. application/x-www-form-urlencoded;
  2. application/octet-stream;
  3. text/plain.

GET request

For a GET request, specify the set of parameters in the URL. For example:

https://google-analytics.bi.owox.com/UA-XXXXX-X?v=1&cid=555&t=pageview&dp=%2Fhome.

Requirements for value formatting

In general, a field value format should comply with the Measurement Protocol’s documentation.

However, some fields should also meet specific requirements as they undergo additional processing by OWOX BI. Please see the table below.

NoteData that does not match the specified format cannot be processed by OWOX BI and will be written as NULL in Google BigQuery tables.

Full name Abbreviation Value type Supported value format
Transaction Revenue tr

currency

Example value:

1234,56

1,234.56

1.234,56

1 234,56

Transaction Tax tt currency
Transaction Shipping ts currency
Product Price pr<productIndex>pr currency
Custom Metric cm<metricIndex> number
       

Checkout Step

cos integer

Example value:

1

1.00

1.0000

Queue Time qt integer
Page Load Time plt integer
DNS Time dns integer
Page Download Time pdt integer
Redirect Response Time rrt integer
TCP Connect Time tcp integer
Server Response Time srt integer
DOM Interactive Time dit integer
Content Load Time clt integer
Product Position pr<productIndex>ps integer
User timing time utt integer
       
Content Group cg<groupIndex> text

Example value:

Hello World 

Custom Dimension cd<dimensionIndex> text
Exception Description exd text
Document Referrer

dr

text
Product Name pr<productIndex>nm text

Using the queueTime (&qt) parameter

By default, the time when a hit is reported equals the time when the hit occurs. However, hits may be reported with a delay. For example, in online payment, a bank confirms a transaction some time after this transaction is made by a user. To match this hit to the time it occurred, the queueTime (&qt) parameter must be used.

The &qt value represents the time delta (in milliseconds) between when the hit occurred and the time it was reported. By setting this parameter, the hit time (value in the time field) will be calculated correctly.

NoteThe &qt value must be of integer type and be greater than or equal to 0.
Otherwise, the &qt will be automatically assigned the NULL value and the hit will be assigned a time when it was reported.

Please see how the data is processed when sending a non-zero parameter &qt below.

OWOX BI Google Analytics
Hit data collection

There are no limits for the &qt value.
Hits will always get to the hit data table ('streaming_') in Google BigQuery regardless of the &qt value.

A hit will get to a data table for the date calculated considering the difference in time between the value of &qt parameter and the time the hit was sent.
Example: A hit, that was sent with &qt=86400000 (-24 hours) on August 10th, 2019, will get into a hit data table collected for August 9th, 2019.

There are limits for the &qt value.
Values greater than 4 hours may lead to hits not being processed.

Session data collection

For session data collection based on the OWOX BI algorithm, the hits will be assigned to the corresponding sessions ('owoxbi_sessions_') within 30 days*.
*After the end of the day when the hits occurred in the Google Analytics property timezone.
If you need the hits are being assigned to the sessions beyond the default period (30 days), contact us at bi@owox.com.

For session data collection based on the Google Analytics algorithm, the hits will be assigned to the corresponding sessions within 48 hours* based on the clientId and timestamp values sent in the custom dimension (&cd).
*After the end of the day when the hits occurred in the Google Analytics property timezone.

Learn how the qt parameter affects assigning transactions to user sessions from this article.

Limitations

  • The request must contain the clientId (&cid) or the userId (&uid) parameter. Without sending at least one of these parameters, a hit will be processed neither in OWOX BI nor in Google Analytics.
  • If you use several hits to send data of a single transaction, you should submit unique parameter values in the actionField object per hit. For example, you can do it by entering different values for Revenue, Tax, or Affiliation in each actionField object. Otherwise, out of two (or more) hits with the same parameter values in the actionField object, only one hit will be recorded by GA.

    While OWOX BI will record all the transaction hits regardless of the received values in the actionField object.

  • In OWOX BI Pipeline, the maximum hit payload size is 16 KB. If exceeded this limit, hits won't be processed and sent to BigQuery.
  • In Google Analytics hit payload must be no longer than 8 KB.

Anytime you can check the number of transactions collected to the BigQuery tables. Read more

HTTP request example

HOST:
https://google-analytics.bi.owox.com/UA-XXXXX-X

PAYLOAD:

"v": 1,
"tid": "UA-XXXXX-X",
"cid": "111111111.111111111",
"t": "event",
"ec": "Call",
"ea": "Request",
"el": "Form №1",
"ev": 0,
"dh": "example.com",
"ds": "call-center",
"uip": "11.111.11.11",
"ua": "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
"dr": "https://www.google.com/",
"qt": 0

Parameter breakdown example:

hitid 4a44b2ce-be1b-41f3-8153-50b65461911e
trackingId
UA-XXXXX-X

clientId 111111111.111111111
type event
eventInfo.eventCategory Call
eventInfo.eventAction
Request
eventInfo.eventLabel
Form №1
eventInfo.eventValue 0
page.hostname example.com
dataSource call-center
device.ip server ip
device.userAgent Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
referrer https://www.google.com/
Was this article helpful?
4 out of 4 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.