{"id":216,"date":"2017-04-27T07:19:39","date_gmt":"2017-04-27T07:19:39","guid":{"rendered":"http:\/\/support.gaconnector.com\/?p=216"},"modified":"2026-04-14T15:22:07","modified_gmt":"2026-04-14T15:22:07","slug":"hubspot-forms-integration-guide","status":"publish","type":"post","link":"https:\/\/gaconnector.com\/docs\/hubspot-forms-integration-guide\/","title":{"rendered":"HubSpot Forms Integration Guide (Legacy Forms)"},"content":{"rendered":"<p data-pm-slice=\"1 1 [&quot;blockquote&quot;,{}]\">The instructions below apply to\u00a0<strong>Cookie-Based integration<\/strong>.<\/p>\n<p data-pm-slice=\"1 1 [&quot;blockquote&quot;,{}]\">Not sure which instructions to follow? Start here:\u00a0<strong><a class=\"ProsemirrorEditor-link\" href=\"https:\/\/gaconnector.com\/docs\/how-to-check-which-ga-connector-integration-type-youre-using\/\">How to Check Which GA Connector Integration Type You\u2019re Using<\/a>.<\/strong><\/p>\n<h4><em>Add Google Analytics data to Hubspot forms with GA Connector\u2019s Hubspot integration.<\/em><\/h4>\n<p>If you&#8217;re using HubSpot forms built with the newest Visual editor, please <a href=\"https:\/\/gaconnector.com\/docs\/integrating-ga-connector-with-hubspot-crm#visual-editor\">click here<\/a> for step-by-step instructions .<\/p>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>Installed either GA Connector\u00a0<a title=\"\" href=\"https:\/\/gaconnector.com\/download\/wordpress\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress plugin<\/a>\u00a0or GA Connector script on your website<\/li>\n<\/ul>\n<pre class=\"lang:js decode:true\" data-url=\"https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/11\/gaconnector-tracking-code.js\"><\/pre>\n<h2>Creating GA Connector custom fields\/properties in Hubspot<\/h2>\n<p>If you haven&#8217;t created custom properties yet for GA Connector in Hubspot, follow the steps below on how to add them.<\/p>\n<ol>\n<li>While on your Hubspot Dashboard, go to <strong>Settings &gt; Properties &gt; Create Property<\/strong><\/li>\n<li>Using the table below as a guide, add the GA Connector label as the label and click on the &#8220;<em>code<\/em>&#8221; icon beside the label field to add the equivalent <strong>input_id<\/strong> as Internal name (e.g. All Traffic Sources &#8211; all_traffic_sources).\u00a0 You can use Single-Line text as <em>Field type<\/em> for all GA Connector fields.<\/li>\n<li>Repeat for all GA Connector fields that you need to track.<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2789\" src=\"https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/04\/create-property.jpg\" alt=\"\" width=\"600\" height=\"704\" srcset=\"https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/04\/create-property.jpg 600w, https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/04\/create-property-256x300.jpg 256w, https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/04\/create-property-51x60.jpg 51w, https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/04\/create-property-128x150.jpg 128w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/>\u00a0<\/p>\n\n<table id=\"tablepress-6\" class=\"tablepress tablepress-id-6\">\n<thead>\n<tr class=\"row-1 odd\">\n\t<th class=\"column-1\">Label<\/th><th class=\"column-2\">Input ID<\/th><th class=\"column-3\">Label<\/th><th class=\"column-4\">Input ID<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-hover\">\n<tr class=\"row-2 even\">\n\t<td class=\"column-1\"><strong>All Traffic Sources <\/strong><\/td><td class=\"column-2\">all_traffic_sources<\/td><td class=\"column-3\"><strong>Last Click Campaign<\/strong><\/td><td class=\"column-4\">lc_campaign<\/td>\n<\/tr>\n<tr class=\"row-3 odd\">\n\t<td class=\"column-1\"><strong>Browser<\/strong><\/td><td class=\"column-2\">browser<\/td><td class=\"column-3\"><strong>Last Click Channel<\/strong><\/td><td class=\"column-4\">lc_channel<\/td>\n<\/tr>\n<tr class=\"row-4 even\">\n\t<td class=\"column-1\"><strong>City (from IP address)<\/strong><\/td><td class=\"column-2\">city<\/td><td class=\"column-3\"><strong>Last Click Content<\/strong><\/td><td class=\"column-4\">lc_content<\/td>\n<\/tr>\n<tr class=\"row-5 odd\">\n\t<td class=\"column-1\"><strong>Country (from IP address)<\/strong><\/td><td class=\"column-2\">country<\/td><td class=\"column-3\"><strong>Last Click Landing Page<\/strong><\/td><td class=\"column-4\">lc_landing<\/td>\n<\/tr>\n<tr class=\"row-6 even\">\n\t<td class=\"column-1\"><strong>First Click Campaign<\/strong><\/td><td class=\"column-2\">fc_campaign<\/td><td class=\"column-3\"><strong>Last Click Medium<\/strong><\/td><td class=\"column-4\">lc_medium<\/td>\n<\/tr>\n<tr class=\"row-7 odd\">\n\t<td class=\"column-1\"><strong>First Click Channel<\/strong><\/td><td class=\"column-2\">fc_channel<\/td><td class=\"column-3\"><strong>Last Click Referrer<\/strong><\/td><td class=\"column-4\">lc_referrer<\/td>\n<\/tr>\n<tr class=\"row-8 even\">\n\t<td class=\"column-1\"><strong>First Click Content<\/strong><\/td><td class=\"column-2\">fc_content<\/td><td class=\"column-3\"><strong>Last Click Source<\/strong><\/td><td class=\"column-4\">lc_source<\/td>\n<\/tr>\n<tr class=\"row-9 odd\">\n\t<td class=\"column-1\"><strong>First Click Landing Page<\/strong><\/td><td class=\"column-2\">fc_landing<\/td><td class=\"column-3\"><strong>Last Click Term<\/strong><\/td><td class=\"column-4\">lc_term<\/td>\n<\/tr>\n<tr class=\"row-10 even\">\n\t<td class=\"column-1\"><strong>First Click Medium <\/strong><\/td><td class=\"column-2\">fc_medium<\/td><td class=\"column-3\"><strong>Last Click Timestamp<\/strong><\/td><td class=\"column-4\">lc_timestamp<\/td>\n<\/tr>\n<tr class=\"row-11 odd\">\n\t<td class=\"column-1\"><strong>First Click Referrer<\/strong><\/td><td class=\"column-2\">fc_referrer<\/td><td class=\"column-3\"><strong>Longitude<\/strong><\/td><td class=\"column-4\">longitude<\/td>\n<\/tr>\n<tr class=\"row-12 even\">\n\t<td class=\"column-1\"><strong>First Click Source<\/strong><\/td><td class=\"column-2\">fc_source<\/td><td class=\"column-3\"><strong>Latitude<\/strong><\/td><td class=\"column-4\">latitude<\/td>\n<\/tr>\n<tr class=\"row-13 odd\">\n\t<td class=\"column-1\"><strong>First Click Term<\/strong><\/td><td class=\"column-2\">fc_term<\/td><td class=\"column-3\"><strong>Number of Website Visits<\/strong><\/td><td class=\"column-4\">page_visits<\/td>\n<\/tr>\n<tr class=\"row-14 even\">\n\t<td class=\"column-1\"><strong>First Click Timestamp<\/strong><\/td><td class=\"column-2\">fc_timestamp<\/td><td class=\"column-3\"><strong>Operating System<\/strong><\/td><td class=\"column-4\">OS<\/td>\n<\/tr>\n<tr class=\"row-15 odd\">\n\t<td class=\"column-1\"><strong>Google Analytics CID<\/strong><\/td><td class=\"column-2\">GA_Client_ID<\/td><td class=\"column-3\"><strong>Device<\/strong><\/td><td class=\"column-4\">device<\/td>\n<\/tr>\n<tr class=\"row-16 even\">\n\t<td class=\"column-1\"><strong>Google Analytics Measurement ID<\/strong><\/td><td class=\"column-2\">GA_Measurement_ID<\/td><td class=\"column-3\"><strong>Region<\/strong><\/td><td class=\"column-4\">region<\/td>\n<\/tr>\n<tr class=\"row-17 odd\">\n\t<td class=\"column-1\"><strong>Google Analytics Session ID<\/strong><\/td><td class=\"column-2\">GA_Session_ID<\/td><td class=\"column-3\"><strong>Pages Visited <\/strong><\/td><td class=\"column-4\">pages_visited_list<\/td>\n<\/tr>\n<tr class=\"row-18 even\">\n\t<td class=\"column-1\"><strong>Google Click Identifier<\/strong><\/td><td class=\"column-2\">gclid<\/td><td class=\"column-3\"><strong>Time Spent on Website <\/strong><\/td><td class=\"column-4\">time_passed<\/td>\n<\/tr>\n<tr class=\"row-19 odd\">\n\t<td class=\"column-1\"><strong>IP Address<\/strong><\/td><td class=\"column-2\">ip_address<\/td><td class=\"column-3\"><strong>Time Zone <\/strong><\/td><td class=\"column-4\">time_zone<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-6 from cache -->\n<p>GA Connector adds UTM information, geolocation, referral information to your Hubspot leads.<\/p>\n<h2>Setting up your form<\/h2>\n<ol>\n<li>Add the GA Connector properties you&#8217;ve created to your form and make the field hidden<\/li>\n<li>After adding all the GA Connector properties you need, hit <strong>Update<\/strong><\/li>\n<\/ol>\n<h2>Embedding your form to your Website<\/h2>\n<p>Instead of using the default embed code that Hubspot has provided. You will need to use the code below:<\/p>\n<pre class=\"\">    <script charset=\"utf-8\" type=\"text\/javascript\" src=\"\/\/js.hsforms.net\/forms\/embed\/v2.js\"><\/script>\r\n    <script>\r\n        hbspt.forms.create({\r\n            region: \"xxx\",\r\n            portalId: \"xxxx\",\r\n            formId: \"xxxxx\",\r\n            onFormReady: function($form) {\r\n                function checkGaconnector() {\r\n                    gaFields = gaconnector.getCookieValues();\r\n                    return !!gaFields.lc_source;\r\n                }\r\n                var gaFields;\r\n                var interval = setInterval(function() {\r\n                    if (checkGaconnector()) {\r\n                        for (var fieldName in gaFields) {\r\n                            var selectors = 'input[name=\"' + fieldName + '\"], input#' + fieldName + ', input#field_' + fieldName + ', input[name=\"' + fieldName.toLowerCase() + '\"], input#' + fieldName.toLowerCase() + ', input#field_' + fieldName.toLowerCase() + ', input[value=\"gaconnector_' + fieldName.toLowerCase() + '\"], \u00a0 \u00a0 ';\r\n                            selectors += 'textarea[name=\"' + fieldName + '\"], textarea#' + fieldName + ', textarea#field_' + fieldName + ', textarea[name=\"' + fieldName.toLowerCase() + '\"], textarea#' + fieldName.toLowerCase() + ', textarea#field_' + fieldName.toLowerCase() + ', textarea.' + fieldName + ', textarea[name=\"param[' + fieldName + ']\"]' + \", textarea[id^='field_\" + fieldName + \"']\";\r\n                            var inputs;\r\n                            if ($form.nodeName) {\r\n                                inputs = $form.querySelectorAll(selectors);\r\n                            } else {\r\n                                inputs = $form[0].querySelectorAll(selectors);\r\n                            }\r\n                            if (inputs === null) {\r\n                                continue;\r\n                            } else if (typeof inputs.length === 'undefined') {\r\n                                inputs.value = gaFields[fieldName];\r\n                            } else {\r\n                                for (var i = 0; i < inputs.length; i++) {\r\n                                    inputs[i].value = gaFields[fieldName];\r\n                                }\r\n                            }\r\n                        }\r\n                        clearInterval(interval);\r\n                    }\r\n                }, 1000);\r\n            }\r\n        });\r\n        \r\n    <\/script>\r\n<\/pre>\n<p><strong>Note:<\/strong> Replace the region, portalId, and formId on lines 4, 5 &amp;\u00a06 with your own. You can find these details on the default embed code that Hubspot provided.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The instructions below apply to\u00a0Cookie-Based integration. Not sure which instructions to follow? Start here:\u00a0How to Check Which GA Connector Integration Type You\u2019re Using. Add Google Analytics data to Hubspot forms with GA Connector\u2019s Hubspot integration. If you&#8217;re using HubSpot forms built with the newest Visual editor, please click here for step-by-step instructions . Prerequisites Installed [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,16],"tags":[],"_links":{"self":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/216"}],"collection":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/comments?post=216"}],"version-history":[{"count":14,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/216\/revisions"}],"predecessor-version":[{"id":3778,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/216\/revisions\/3778"}],"wp:attachment":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/media?parent=216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/categories?post=216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/tags?post=216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}