Event Collection

Learn how to collect events to your data cloud.

With GrowthLoop, you can use any events you collect from your website and mobile app that land in your Data Cloud to create audienes and journeys. Whether you are using MetaRouter, Google Analytics, Heap, Amplitude, Segment, Rudderstack, Snowplow to ingest events, as long as they are loading to your Data Cloud, they can be used in GrowthLoop.

If your company does not currently collect event data from your mobile and web application into your Data Cloud and you are looking for an easy to use solution, you can always use the Event Collection Service.

In this article, you'll see how to implement the Event Collection Service in your website. Once your event data is landing in your Data Cloud you can configure your Event tables as Datasets in GrowthLoop to begin using them in Audiences and Journeys in a matter of minutes.

event collection diagram

Event Collection Service to your Data Cloud

  • To use our supported event collection (in partnership with MetaRouter), you'll need to:
    1. Create a cluster that writes to BigQuery.
    2. Add a snippet of code to the global header of your site.
    3. Implement any additional tracking for your use cases. Examples and docs can be found here.
  • GrowthLoop can create the cluster on our end. Please contact your solutions architect so they can set up the cluster for you. This cluster will contain all the services you need to start sending events from your property to your integrations.
  • While GrowthLoop creates the cluster, we'll set up BigQuery as a destination. Please provide your solutions architect with your credentials and project ID.
  • Once you've created the cluster, it is time to add code to your site. Add the code snippet below to the global header of your site:
<script type='text/javascript'>
!(function() {
  var analytics = (window.analytics = window.analytics || [])
  if (!analytics.initialize) {
    if (analytics.invoked) {
      window.console && console.error && console.error('MetaRouter snippet included twice.')
    } else {
      analytics.invoked = !0
      analytics.methods = [
        'trackSubmit',
        'trackClick',
        'trackLink',
        'trackForm',
        'pageview',
        'identify',
        'reset',
        'group',
        'track',
        'ready',
        'alias',
        'debug',
        'page',
        'once',
        'off',
        'on',
        'addSourceMiddleware',
        'addIntegrationMiddleware',
        'setAnonymousId',
        'addDestinationMiddleware',
      ]
      analytics.factory = function(e) {
        return function() {
          var t = Array.prototype.slice.call(arguments)
          t.unshift(e)
          analytics.push(t)
          return analytics
        }
      }
      for (var e = 0; e < analytics.methods.length; e++) {
        var key = analytics.methods[e]
        analytics[key] = analytics.factory(key)
      }
      analytics.load = function(key, e) {
        var t = document.createElement('script')
        t.type = 'text/javascript'
        t.async = !0
        t.src = ("https:"===document.location.protocol?"https://":"http://")+"tbd.com/"+key+".js"
        var n = document.getElementsByTagName('script')[0]
        n.parentNode.insertBefore(t, n)
        analytics._loadOptions = e
      }
      analytics.SNIPPET_VERSION = '4.13.1'
      analytics.load("growthloop_marketing_site")
      analytics.page()
    }
  }
})()
</script>

In the snippet you'll need to replace t.src = ("https\:"===document.location.protocol?"https\://":"http\://")+"tbd.com/"+key+".js" with wherever the file is hosted. For example, if the file was at https://growthloop.com/files/growthloop_marketing_site.js then that line should be
t.src = "https://growthloop.com/files/growthloop_marketing_site.js or t.src = ./files/growthloop_marketing_site.js

By default, we'll set up Page Events, but a solutions architect can help you track more custom events like Add to Cart, and Purchase Completed if you'd like.

Every Analytics.js API call has a common structure. While some specific calls pass extra information, they will all pass the information detailed in this section. While our supported event collection can include all of these fields, not every destination will accept every field listed below.

FieldTypeDescription
anonymousIdObject (optional)A pseudo-unique substitute for User ID. This is for cases when you don't have an absolutely unique identifier.
contextObject (optional)Dictionary of extra information that provides useful context about a message that is not directly related to the API call
integrationsString (optional)Dictionary of destinations to either enable or disable
messageIdString (implicit)Automatically collected, this is a unique identifier for each message that lets you find an individual message across the API
receivedAtDate (implicit)The timestamp of when a message is received by MetaRouter
sentAtDate (optional)The timestamp of when a message is sent to MetaRouter
typeString (implicit)Type of message, according to the Event method
userIdString (required)Unique string that identifies a user in your database
versionNumber (implicit)Version of the Tracking API that received the message, automatically set by MetaRouter

Once you have everything set up, you should start seeing your events populate in BigQuery.

event collection diagram event collection diagram

What’s Next

Once you have Events Streaming into BigQuery, you can start exporting audiences.