Blog

Integration and API news for developers

Set Your Goals, with Webhooks

14th September 2018

As Cyclr’s in-house digital marketer data should be my best friend. It’s the best indication of where to make improvements to both site usability and to our marketing efforts/sales funnel. However, with user touch points being spread across multiple applications, each performing a specific task in our application stack, wrangling that siloed data could be a challenge.…… but happily we have a tool that can make my life easier…..Cyclr itself.

Rather than having to go to each application to look for individual results I have a way to see from where and when our touch points have been used, alongside our other performance data.

While their are a host of dashboarding tools available to aggregate and transform your data into graphical masterpieces, the challenge can be highlighting those meaningful customer-driven events from your range of business systems.

I thought it would be worthwhile to share how I use Google Analytics, Google Hit Builder and Cyclr to optimise our marketing efforts, if you like it, you can replicate it.

Google Analytics + Google Hit Builder + Cyclr Webhooks = Goal

Why Google Analytics?

GA is the analytical backbone of the majority of the web. It’s a one stop shop for your website’s usage data, allowing you to monitor where your users are going and what they are doing. You can define goals within the platform; key actions on your website that are triggered by your users. This data is valuable, as it lets you see which content is driving the actions you desire, allowing you to make data driven decisions to make and test improvements.

What is Google Hit Builder?

Google Hit Builder is a developer tool that allows you to construct and validate Measurement Protocol hits using the Measurement Protocol Validation Server.

Google Hit Builder

The tool allows you to build a URL parameter based “hit” which can be sent to Google Analytics to register a goal or conversion has been completed.

These URL parameters are commonly used as UTM (Urchin Tracking Module) parameters for link tracking, giving you the ability to see which links, and from where, your users are entering your website.

The building of these parameters often includes:

  • UTM Campaign
  • UTM Source
  • UTM Medium

Each of these can have a preset value to identify the source of the link, an example of which being:

 

https://www.cyclr.com/?utm_source=wired&utm_medium=tech-press&

utm_campaign=wired-guest-post-campaign-10-09-18

 

We’re going to be using similar parameters to pass an event trigger into Google Analytics.

 

What’s your Goal?

If you’re looking to track events in external applications within Google Analytics, firstly identify which areas of your sales process you want to monitor and which system they are recorded in.

For example, if you want to track sales you maybe using a CRM such as Salesforce or Pipedrive. Or if you want to track email clicks you may be using an email service provider such as ActiveCampaign or MailChimp.

In my case, I wanted to trigger a goal when a user had initiated a chat and entered their email address in our Intercom messaging service. I wanted to track this in Google Analytics so I could monitor which pages chats are initiated from and where the user originated, factors I want to take into account when measuring our website’s page performance.

Webhook Triggered Goals

In order to track these goals I use Cyclr to create an automation workflow that is triggered when an event happens in your internal system, firing a custom Google Analytics Event Hit using our POST Webhook connector.

With your goal in mind, you will need to create tracking parameters that will be used in both Google Analytics and your Event Hit URL. Much like the example UTM link above, you will need:

  • Category
  • Action
  • Label

Setting up Goals in Google Analytics

In your Analytics account, go to Settings (the cog in the bottom left corner) and click on “Goals” in the third column of options.

Google Analytics setting up a Goal

In this screen, click the red “NEW GOAL” button to be presented with a 3 step setup process.

For your new goal you’re going to want to select “Custom” before clicking continue. Name your goal and select “Event” as the goal type.

Setting up a goal in Google Analytics

Here, you get to assign the goal values you want to track, Category, Action, Label and Value.

 

NOTE: In order for Google Analytics to track your external goal you need to ensure these goal values match in your Analytics account AND your trigger URL constructed in Google Hit Builder.

Creating and Triggering your Goal

Now you’ll need to build your Hit. This will include a series of two letter short codes that correspond to your event values (full list of parameters available here – https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters ). To get you started, below is how the Google Analytics goal setting matches to the Hit parameter:

  • Category = ec
  • Action = ea
  • Label = el
  • Value = v

 

NOTE: You can make these values dynamic by using Cyclr’s merge fields within the step setup process.

When you select “Type a Value” in your POST Webhook connector, paste in your Hit URL and move the cursor to where you want the dynamic content to be added to the Hit URL; click on the the merge field dropdown and select any of the values made accessible from the previous connected step of the workflow.

 

Now you need to build your hit. Ensure that you add your Google Analytics ID (found in your Google Analytics settings) to the “tid” parameter in the Hit Builder, as well as an anonymous cid (Client ID). Then add the additional parameters, as below, to ensure they match your goal in Google Analytics.

Building your Hit

Validate your Hit, then we’re ready to set up the automation.

Building your Workflow

To build the workflow, I’ll use my example of registering a goal when an email address has been added to our Intercom chat.

In this case, the integration workflow is pretty simple, with only two steps being required: the “Lead Email Added” Intercom webhook and the Cyclr POST webhook connector. Creating a workflow that looks like this:

Building your workflow

The only additional setup required is by placing your Hit URL into the POST webhook connector.

Formatting your Hit URL

From entering your parameters into the Hit Builder you should be presented with a parameter string, looking something like this:

 

v=1&t=event&tid=ua-28292-2920&cid=193bfc87-9a62-4032-aa5f-efd859c591db&ec=test-campaign&ea=test-action&el=test-label

 

To make this usable, add https://www.google-analytics.com/collect? to the front of your parameters, giving you something like:

 

https://www.google-analytics.com/collect?v=1&t=event&tid=ua-28292-2920&cid=193bfc87-9a62-4032-aa5f-efd859c591db&ec=test-campaign&ea=test-action&el=test-label

 

This is the address you will be using in the POST Webhook step in your Cyclr workflow.

So click on settings on your POST Webhook step in the builder and paste your full Hit URL in the URL field.

 

There it is. Done. Now set your workflow live and trigger the webhook in your source application. By jumping back to the Cyclr builder/orchestration layer you should see the workflow running. If you then go into your Google Analytics account and click on “REAL-TIME” in the sidebar you can see Google picking up the Hit and registering the event.

So there we go, we’ve registered external user activity in your Google Analytics account, all enabled by Cyclr.

You can extend this however you want, creating new hits and workflows to track events in any other application you use. Try mixing your workflows up with some logic steps to only post hits when very specific requirements come in. Or add dynamic Hit labels and parameters using our mergefieldsThe possibilities are endless.

Watch out for future blogs or, should you wish to chat directly with me, don’t hesitate to email me at daniel@cyclr.com

Found this content useful? Then why not share it!