Universal Analytics Data Stream
Universal Analytics Data Stream allows to collect raw hit-level non-sampled data into your Google BigQuery account.
Before you begin
- Make sure that BigQuery is connected to SegmentStream.
- Make sure that Google Analytics tracker already implemented in website.
- You subscribed to SegmentStream enterprise plan
How it works?
After simple integration with Google Tag Manager or Source Code SegmentStream will start listening all Google Analytics events, already implemented on website, and push same events into Google BigQuery in real-time.
- Inside the admin panel go to Google BigQuery ▸ Data Streams page and click Add data stream.
- Choose Universal Analytics from the list.
- Define Google BigQuery Destination table where collected data will be stored.
- Define UTC offset from the list.
- Select Integration type. There are 2 types: GTM or Analytics.js
- Copy Snippet code.
- Click Save and follow the further instructions to integrate code.
Integration with Google Tag Manager (GTM)
Choose this method if your Google Analytics integrated with Google Tag Manager.
In the Variables section click New to create a customTask variable.
Add variable to the each of the Universal Analytics tags
Open Universal Analytics tag
Click on Tag Configuration > check Enable overriding settings in this tag
Go to More settings > Fields to set and click Add Field button.
customTaskas Field name and
Save the tag and publish the container.
It is important to add the customTask field to all your Universal Analytics tags. For example, event tags, conversion tracking tags etc.
Integration with Analytics.js (site code)
Choose this method if your Google Analytics integrated with website source code.
Add Snippet from analytics.js type to the website source code on each page after the command
ga('create', 'UA-XXXXX-Y', 'auto'); and before
ga('create', 'UA-XXXXX-Y', 'auto'); <% snippet code from admin panel %> ga('send', 'pageview');
Check if integration works correctly
Go to your website, open console > network and filter results with track.segmentstream endpoint. If snippet integrated correctly you will see requests:
Go to your Google BigQuery account and check if table with name from Destination table appears in your DataSet.
|hit_id||string||Nullable||Unique hit identifier|
|ip||string||Nullable||Visitor’s IP address|
|received_at||integer||Nullable||Hit time in milliseconds passed since January 1, 1970|
|ssuid||string||Nullable||Cross-domain unique user’s identifier|
|payload||string||Nullable||Raw hit payload|
|cookie||record||Repeated||1st-party cookies of major advertising platforms|
|date||date||Nullable||partitition field, Date of the hit with UTC offset|
|user_agent||string||Nullable||Visitor’s device userAgent|
Default cookies: _ym_uid, _ga, ssaid, _fbp, _fbc, tmr_lvid. Can be expanded by request to [email protected]
This document was last updated on August 19, 2020. If you notice any gaps, outdated information or simply want to leave some feedback to help us improve our documentation, please let us know!