Learn how to set up Google Ads conversion tracking in GoHighLevel. Track leads, form submissions, calls, and GA4 events to improve ad performance and maximize conversions.
Here is the custom JavaScript variable code for Google Tag Manager to capture user-provided form data from GoHighLevel’s local storage. This data can be sent to activate enhanced conversion tracking in Google Ads, as explained in the video.
function() {
var userDataString = localStorage.getItem('_ud');
if (userDataString) {
try {
var userData = JSON.parse(userDataString);
return userData.email || 'Default Name'; // Use a default or return an empty string if preferred
} catch(e) {
// Handle parsing error
console.error('Error parsing _ud:', e);
return 'Error Name'; // Return an error name or any other fallback value
}
}
// Return null, a default name, or any other fallback value if _ud is not found
return 'No Name Found';
}