Talk given at the Eloqua user group meeting in March 2016 for the Silicon Valley / San Francisco area held at Adaptive Insights' offices.
I recommend that marketers adopt the form submission-method for tracking goals in their online analytics systems. This presentation explains the importance and purpose of having a scalable way to do goal tracking online and includes sample code on how to implement it effectively.
Matt Conway - Attorney - A Knowledgeable Professional - Kentucky.pdf
Modern goal tracking stratgies for the web
1. 1
Michael Freeman – Director, Demand Generation & Marketing Operations
San Francisco/Silicon Valley Eloqua User Group – March 23, 2016
Modern Goal Tracking Strategies & Analytics
3. 3Michael Freeman, @spanishgringo
We tend to improve what we measure
Good decisions are very hard without good data
Yet, good measurement practices are very rare
Good measurement is the foundation of DG
4. 4Michael Freeman, @spanishgringo
Not enough investment in understanding the data or
what’s important to the business
Choose a path of least resistance for data gathering
We don’t think about the future
Why don’t most marketers measure well?
6. 6Michael Freeman, @spanishgringo
Not enough investment in understanding the data or
what’s important to the business
– We setup the wrong goals to track
Choose a path of least resistance for data gathering
– Data quality suffers & maintenance eats a lot of time
We don’t think about the future
– A limited view of the data & can’t handle change well
Goal tracking suffers as a result
7. 7Michael Freeman, @spanishgringo
Thank you page-based
Pros
Quick to start using
Seemingly easy
Low technical knowledge needed
Cons
Not scalable or very flexible
SEO/WEB needs != Data needs
Lots of maintenance
Form submission-based
Pros
Flexibility by using virtual URLs
Very rich data gathering
Separate tracking from UX & SEO
Low maintenance
Cons
Requires some up-front planning
Higher technical requirements
Goal tracking – a tale of two methods
8. 8Michael Freeman, @spanishgringo
1. Create a common goal tracking function (GTF)
– Define the variables to pass to the GTF
• What? = Conversion Type
• Where? = Location
• So What? = Goal Value
– Hook in your various goal tracking services
– Host it in a common location such as Google Tag Manager
2. Form preparation
– Determine how you’ll pass the variables to the GTF
– Setup a global form listener for onSubmit events
3. Configure goals in your analytics services, as necessary
Setting up the form submission method
9. 9Michael Freeman, @spanishgringo
conversionType (required): This will tell us where to bucket the conversion in our tracking systems.
– I recommend using a number followed by a forward slash and description of the conversion in short, URL-style text.
– 2/online-demo, 1/contact-us, 3/asset-download, 1/free-trial
trackPath (optional): The location of the form completion. In almost all circumstances it will be defined by the value of
window.location.pathname
goalValue (optional): This value captures the $-value we associate with a goal completion. In most cases this will be a
static value associated with the conversionType and is typically used dynamically only in ecommerce situations
trackPath + "/form/" + conversionType
"/products/adaptive-suite" + "/form/" + "2/online-demo"
/products/adaptive-suite/form/2/online-demo
The what, where, & how much of tracking
10. 10Michael Freeman, @spanishgringo
goalCompletion: the namespaced object to handle all logic
bindFormSubmit: sets the event listener for onSubmit and calls trackGoal
trackGoal: fires off all of the individual tracking functions for each service
trackGoal_ga: fires off the call to GA
trackGoal_optimizely: fires off the call to Optimizely
trackGoal_bing: fires off the call to Bing Ad Center
Etc.
Anatomy of goalCompletion {}
11. 11Michael Freeman, @spanishgringo
Load goalCompletion from GTM
<script type="text/javascript">
try {
if (typeof goalCompletion === "undefined") {
$.ajax({
url: "//yourwebsite.com/assets/js/goalCompletion.js",
dataType: "script",
cache: !0
}).done(function(){
//look for any eloqua forms and bind the submit handler
if ($('#eloquaForm').length > 0) {
//insert code here to set the conversion variables
goalCompletion.bindFormSubmit(typeof conversionType == 'undefined' ? undefined : conversionType, typeof
trackPath == 'undefined' ? undefined : trackPath, typeof goalValue == 'undefined' ? undefined : goalValue);
}
});
}
} catch (error) {}
</script>
Google Tag Manager is a great way to include this script loader on all of your pages
12. 12Michael Freeman, @spanishgringo
Adding form-based goal tracking to GA
• Make sure you choose
regular expression
• Use the same pattern to
define form viewing for
better funnel reports
13. 13Michael Freeman, @spanishgringo
Form has default hidden field
called conversionType
The form load handler reads the
conversionType field value and
sets the form submit handler
variables
On form submission (passing
html5 validation) the trackGoal
function is called
All tracking services are updated
Putting it all together
14. 14Michael Freeman, @spanishgringo
We can track goal completions
anywhere on the site
We can see where the form is
most likely to be completed
We can create a separate set of
goals to track Tier-2 goals
It's easy to update and maintain
since it's tied to the form code,
not the destination URL
Putting it all together - continued
15. 15Michael Freeman, @spanishgringo
Take the time to think about your reporting comprehensively
Use goals that define your business / main touch points
Put in a scalable system for tracking and reporting on goals
Start using the form-submission method
Teach your peers how to get more out of using better analyses/data
Final thoughts
18. 18Michael Freeman, @spanishgringo
Goal tracking with goalCompletion
var goalCompletion = {
bindFormSubmit: function(conversionType, trackPath, goalValue) {//code},
trackGoal: function(conversionType, trackPath, goalValue) {//code},
trackGoal_ga: function(a, b, c) {//code},
trackGoal_optimizely: function(a, b, c) {//code},
trackGoal_bing: function(a, b, c) {//code},
//add more services here
//end goalCompletion
}
19. 19Michael Freeman, @spanishgringo
goalCompletion.bindFormSubmit()
bindFormSubmit: function(conversionType, trackPath, goalValue) {
try {
//add in validation code if you use a 3rd party validator like jQuery Validate
// if (form is valid){ call the submit hander in the validate object etc…}
$("form").submit(function(){
goalCompletion.trackGoal(conversionType, trackPath, goalValue);
});
} catch (e) {}
}
20. 20Michael Freeman, @spanishgringo
goalCompletion.trackGoal()
trackGoal: function(conversionType, trackPath, goalValue) {
//set goal defaults if none passed
goalCompletion.conversionType = conversionType || goalCompletion.conversionType || "unknown-conversion";
goalCompletion.trackPath = trackPath || goalCompletion.trackPath || document.location.pathname;
goalCompletion.goalValue = goalValue || goalCompletion.goalValue || 100;
if((/^[1-5]//).test(goalCompletion.conversionType)) {
goalCompletion.conversionType = "/form/" + goalCompletion.conversionType;
}
try{
// fire off GA
goalCompletion.trackGoal_ga(goalCompletion.conversionType, goalCompletion.trackPath, goalCompletion.goalValue);
} catch(error) {
console.log("errorGA:n" + error);
}
try{
// fire off Optimizely
goalCompletion.trackGoal_optimizely(goalCompletion.conversionType, goalCompletion.trackPath, goalCompletion.goalValue);
} catch(error) {
console.log("errorOpt:n" + error);
}
/* services not in use right now */
//goalCompletion.trackGoal_linkedIn(goalCompletion.conversionType, goalCompletion.trackPath, goalCompletion.goalValue);
//goalCompletion.trackGoal_acme(goalCompletion.conversionType, goalCompletion.trackPath, goalCompletion.goalValue);
}
22. 22Michael Freeman, @spanishgringo
Resources to pass more web campaign information with form submissions
https://moz.com/ugc/how-to-measure-roi-for-leadgen-websites
https://github.com/spanishgringo/ga-campaign-tracking
Bonus Material – Passing GA data to Eloqua