Hi,
Any tips on best practices or personal experiences/challenges to share when integrating Marketo with GA? I have read through this great post on the Champion blog a while ago: Google Analytics and Marketo: Events and Forms and APIs, Oh My!
It's great but there are also quite a few other posts about linking GA Client ID to the Lead ID via JavaScript to a form hidden field.
What would be the most efficient way to do the linking between both IDs? Any cool solutions anybody would want to share that they achieved with the API and Webhooks?
Thanks!
/Erik
Solved! Go to Solution.
Trevor, any time the {{Lead.Id}} token is available you can use it as the GA User-ID -- you just need to interpolate the token into your JS.
But when it isn't available in JS (i.e. on a non-Marketo page, or before session association is complete) this will not be possible on the client side. You would use the measurement protocol from a webhook to accomplish the same.
Hey Erik Heldebro,
Did you ever find a solution for linking the GA Client ID to the Lead ID via Javascript?
Trevor, any time the {{Lead.Id}} token is available you can use it as the GA User-ID -- you just need to interpolate the token into your JS.
But when it isn't available in JS (i.e. on a non-Marketo page, or before session association is complete) this will not be possible on the client side. You would use the measurement protocol from a webhook to accomplish the same.
Maybe it will be helpful - Ultimate Guide to end-to-end Marketo and Google Analytics Integration
https://www.linkedin.com/pulse/ultimate-guide-end-to-end-marketo-google-analytics-khomichenko/
Just FYI - the original post outlining this solution is from Stephan Hamel - https://www.stephanehamel.net/assets/docs/MarketoGACheatSheet_SHamel_150824.pdf
You don't like the stolen one? 🙂
There actually is one significant error (both in the original and in the derivative one). Without using the GA eventCallback and/or hitCallback you will lose hits.
For example, this snippet
form.onSuccess(function(values, followUpUrl){
dataLayer.push({
event: "mktoLead",
mktoFormId: form.getId()
});
return true;
});
must actually be
form.onSuccess(function(values, followUpUrl){
dataLayer.push({
event: "mktoLead",
mktoFormId: form.getId(),
eventCallback : function(){
document.location.href = followUpUrl;
},
eventTimeout: 2000
});
return false;
});