Google Cloud Data Integration
Using Conductrics together with custom visitor data you have stored in the Google Cloud
Enabled upon requestAt this time, the Google Cloud Data Integration is available upon request. If you don't see the options discussed here in the Conductrics Admin, please contact Conductrics so we can get it enabled for your account.
What You'll Need
First, make sure you have:
- A Conductrics account
- A Google Cloud account
- Some kind of custom visitor data that you'd like to use with Conductrics, stored somewhere in the Google Cloud. For instance, you might store some kind of interesting visitor data in BigTable, Cloud SQL, Cloud Storage, or BigQuery.
Here's a walkthrough of the setup process:
In order to use the integration, you'll need the following, which will be explained here:
- A BigQuery view to power the setup screens in Conductrics, for you and other users in your company. The BigQuery view should contain the fields that you want to share with Conductrics.
- A "service account" that gives Conductrics permission to query the BigQuery view.
- A visitor identifier that you can share with Conductrics, via a "cookie" or passed to our API.
To use the integration in production, you will also need:
- A Cloud Function that Conductrics can use to fetch visitor data for actual visitors in "real time", as they visit your pages or apps that use Conductrics. This is explained below (see "Providing a Cloud Function for Real-Time Visitor Data Access").
Providing a Cloud Function for Real-Time Visitor Data Access
As discussed earlier, the "Hit BigQuery Directly" option isn't appropriate for production use or workloads. When it comes time to go live in production, you'll need to create a Cloud Function that retrieves the actual visitor data from a database of some kind.
The database lookup needs to be reasonably fast - just a few milliseconds preferably, but use whatever performance guidelines you feel are appropriate. Fast-enough performance is generally easy to accomplish using Bigtable, Cloud SQL, Cloud Storage, or similar.
Your Cloud Function should:
- Look for a query parameter called
vid - Based on the
vidvalue, do whatever is needed to retrieve the data for the appropriate visitor data record on your side. - Return the data as the
inputsportion of a simple JSON object.
For instance, here's a sketch of what you might do in Node.js / Express code:
app.get('/visitor-lookup', function (req, res) {
// the "visitor lookup id" is passed as a query param called "vid"
var visitor_id = req.query.vid
// Now do whatever is appropriate to get the appropriate data!
// For instance, you might execute a SQL query something like:
// SELECT * FROM My_Visitors WHERE visitor_id = :visitor_id
// Here's a "mock record" that illustrates the type of data you might return:
var visitor_record = {age: 11, rev_total: 1.1, status: 'vip', Cust_type: 'A'}
// Now return a JSON object, with the visitor data as the "inputs" portion:
res.json({
inputs: visitor_record
});
});The result when called might look something like this:
{
"inputs": {
"age": 11,
"rev_total": 1.1,
"status": "vip",
"Cust_type": "A"
}
}
In addition to the
vidparameter, your cloud function will also be provided with adtparameter which is the unique identifier for your Deploy Target. In some cases this may be helpful to determine which data you want to return.
Restricting Access via Basic AuthorizationThere's an option for requiring HTTP Basic Authorization when specifying the URL for your Cloud Function. You can use that to make sure that the function can't be accessed by just anyone who stumbles upon the URL. It's up to you to look at the
Authorizationheader to get the username and password being presented, and to respond with a403 Not Authorizedif they aren't correct. Feel free to contact Conductrics for help with this!
Updated about 1 year ago