Set Your Goals, with a Webhook

Using Webhooks to set goals

Updated on by Daniel Twigg

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. Happily, we have a tool that can make my life easier, Cyclr itself and its Webhook functionality.

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

While there 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. In return this allows 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.

Screenshot of the Google Hit Builder interface demonstrating how to validate a hit.

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

These URL parameters are commonly used as UTM (Urchin Tracking Module) parameters for link tracking. These give 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 is:

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. Then which system they are recorded in.

For example, if you want to track sales you may be using a CRM such as Salesforce or Pipedrive. Alternatively, 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. As well as, the user origin, factors I want to take into account when measuring our website’s page performance.

Webhook Triggered Goals

What is a Webhook?

We have discussed what a webhook is, and that they are also referred to as event-triggered APIs in integrations. They are one of the few ways web applications can communicate with each other. Sending real-time data from one application to another when a given event or trigger occurs. Rather than sending repeated requests for new events.

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. This fires 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.

A screenshot of the Google Analytics interface demonstrating how to set up a Goal, an arrow highlights the 'Goals' link.

On 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.

A screenshot of the Google Analytics interface and demonstrating the step by step process of setting up a new goal before implementing the webhook workflow.

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 shortcodes 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 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 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.

A screenshot of the Google Hit Builder interface demonstrating the steps to build your hit needed for the webhook workflow.

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

Building your Webhook 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:

A screenshot of the Cyclr integration builder demonstrating the workflow with intercom and a Webhook to achieve the desired results in Google Analytics.

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 merge fields. The 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

About Author

Avatar for Daniel Twigg

Daniel Twigg

With over 12 years experience in the Digital Marketing arena, covering industries including IoT, SaaS, fitness, computer gaming and music, Daniel has been Cyclr's marketing manager from the early days of the platform. Follow Daniel on LinkedIn

Ready to start your integration journey?

Book a demo to see Cyclr in action and start creating integration solutions for your customers

Recommended by G2 users