Overview

Connection Type:

Server-side


Installation Instructions

1. Create a BigQuery Table for your Converge Data

  1. Log into your Google Cloud console at console.cloud.google.com

  2. Choose your relevant Google Cloud Project from the top bar. If you do not have a Google Cloud Project yet, you can create one following the instructions here.

  3. From the top search bar, search for bigquery and pick the BigQuery service.  

  4. In the BigQuery Explorer, click on Add.  

  5. From the side-pane, choose Google Cloud Storage, this will open the Create table modal.  

  6. In the Create table modal, choose Empty table as a Source. Create a new Data set and call it converge_data, in the Table-field choose a name for your table, e.g. events.  

  7. In the Schema section, flip the switch to Edit as text and paste the schema below. Click on Create Table after.

Great, now you have a table for your Converge Events, follow the guide below to set up a connection that streams Converge events into this BigQuery Table

2. Stream Converge Data into your BigQuery table

  1. The first thing we need to do in Google Cloud is set up a service account. Start by going to the sidebar menu and choosing IAM and admin > Service accounts.  

  2. Click on Create Service Account.  

  3. Fill in service account name, e.g. converge-bigq-account and click on Create and continue.  

  1. Under Grant this service account access to the project, choose the BigQuery Data Owner scope and click on Done.  

  1. Pick your newly created service account from the list of Service Accounts and choose Manage keys.  

  1. Click on Add Key and Create new key. In the popup choose JSON and click on Create. This will download a file that ends with .json.  

  1. Open your Converge Dashboard at app.runconverge.com and navigate to the Connections Tab. Click on
    Create New Connection
    .  

  1. Give your connection a name, choose BigQuery from the app list. Drop your .json key file in here and fill in the Dataset ID and Table ID you created as per above. Then click on “Create Connection”.  

  1. Done 🎉.

Multi-touch attribution support

Converge preprocesses all events and enriches them with all available profile and session information to make your attribution data warehouse queries as simple as possible.

Profile Information

Every event that is forwarded includes all available information Converge has on that profile until that moment, ranging from $ip_address all the way to $email.

Events that typically do not have an $email property associated with them (e.g. $page_load) will still contain this property if we were able to identify this profile before the $page_load happened.

Profile Merging

Converge may combine multiple profiles into one if there is an overlap in aliases. This means that the profile_id field in your events table may become out of date. Under the ‘Advanced’ tab of the BigQuery connection configuration, you can configure a table to stream these profile merges to. You can create this table as follows:

  • Under your Converge dataset (converge_data), create a new table, e.g. profile_merges.
  • In the Schema section, flip the switch to Edit as text and paste the schema below. Click on Create Table after.

To use this table, it’s important to note that profiles maybe merged multiple times. For example profile A and B could be mapped to C as follows:

  • (A, C)
  • (B, C) Later on, profile C could be merged into profile D:
  • (C, D) In this case, profiles A, B, and C, would all be mapped to D. To deal with this, we recommend creating a (materialized) view that recursively resolves these mappings. Here’s an example query to achieve this:
SQL
WITH RECURSIVE profile_merges AS (
  SELECT 
    timestamp, 
    old_profile_id, 
    new_profile_id, 
    ARRAY[old_profile_id] AS visited_profiles,
    1 AS depth,
    FALSE AS is_circular_reference
  FROM 
    `your-project-name.your-dataset-name.profile_merges`
  UNION ALL
  SELECT 
    pmr.timestamp, 
    pm.old_profile_id,
    pmr.new_profile_id, 
    ARRAY_CONCAT(pm.visited_profiles, [pmr.new_profile_id]) AS visited_profiles,
    pm.depth + 1 AS depth,
    IF(pmr.new_profile_id IN UNNEST(pm.visited_profiles), TRUE, pm.is_circular_reference) AS is_circular_reference
  FROM 
    profile_merges pm
  JOIN 
    `your-project-name.your-dataset-name.profile_merges` pmr
  ON 
    pm.new_profile_id = pmr.old_profile_id
  WHERE
    pmr.timestamp > pm.timestamp
    AND NOT pm.is_circular_reference
)
SELECT 
  old_profile_id, 
  MAX_BY(new_profile_id, depth) AS new_profile_id
FROM 
  profile_merges
GROUP BY 
  old_profile_id;

Querying attribution data

The attributed first_touch_properties etc. columns are deprecated and are no longer being filled, see here.

The events table contains all the data you need to build custom attribution models. You can easily construct the customer’s touchpoints through the session_id and session_properties columns.

A multi-touch model can be broken down into the following steps:

  1. Selecting conversion events
  2. Selecting touchpoints
  3. Joining touchpoints with conversion events according to the attribution window
  4. Applying the attribution model
  5. Aggregating conversion metrics by touchpoint

This model can be adapted to 100% flexibly build attribution insights. The examples below show how to build basic first-touch and last-touch models and count the number of orders in BigQuery.

The session columns have the following structure:

session_id
string
required

Session ID of the event

session_properties
Session Properties Object
required

Properties containing information about the session of the forwarded event

Deprecation of pre-processed attribution columns

Converge previously supported the following columns:

  • first_touch_properties and first_touch_session_id
  • last_touch_properties and last_touch_session_id
  • first_touch_paid_properties and first_touch_paid_session_id
  • last_touch_paid_properties and last_touch_paid_session_id

These columns are deprecated and are no longer being filled. The recommended way to build multi-touch attribution models is to use the session_id and session_properties columns in the Converge data. These allow full flexibility in building custom attribution models while maintaining correctness.


An example query

As an example, the following query on top of the Converge Table gives you the number of times an SKU was ordered:

SQL
SELECT
  string(item.sku) sku, count(*) order_count
FROM `your-project-name.your-dataset-name.your-table-name`
LEFT JOIN unnest(json_extract_array(event_properties.items,'$')) item
WHERE event_name = 'Placed Order'
GROUP BY sku
ORDER BY order_count DESC
Make sure you replace your-project-name, your-dataset-name and your-table-name with your appropriate values.

Converge functionality

This integration supports the following Converge connection functionality.

Converge FeatureSupported
Custom Events
Filters
Server-side Conversions

Event Mapping

Converge automatically sends all implemented events from the Converge Spec and any custom events to BigQuery.

Converge Event NameBigQuery Name
$page_load$page-load
Viewed ProductViewed Product
Viewed CollectionViewed Collection
Added To CartAdded To Cart
Started CheckoutStarted Checkout
Added Payment InfoAdded Payment Info
Placed OrderPlaced Order
Started SubscriptionStarted Subscription
Received Refund Received Refund