{"id":3017,"date":"2023-02-03T03:18:59","date_gmt":"2023-02-03T03:18:59","guid":{"rendered":"https:\/\/gaconnector.com\/docs\/?p=3017"},"modified":"2023-05-02T09:20:41","modified_gmt":"2023-05-02T09:20:41","slug":"how-to-create-custom-events-in-salesforce-to-ga4","status":"publish","type":"post","link":"https:\/\/gaconnector.com\/docs\/how-to-create-custom-events-in-salesforce-to-ga4\/","title":{"rendered":"How to Create Custom Events in Salesforce to GA4"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">GA Connector comes with a built-in set of data points from standard objects that it automatically sends from Salesforce to Google Analytics, however, these data points are not always enough. <\/span><span style=\"font-weight: 400;\">You may want to send your own data points that are not part of a custom package.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">With GA Connector, you can create and send two types of events to GA4:<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><b>Object creation events<\/b><b><br \/>\n<\/b><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"> E.g. when a new Account is created, an event will be sent to Google Analytics.<\/span><\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Field update events<\/b><span style=\"font-weight: 400;\"> When a given field is updated, its new value will be sent to Google Analytics.<\/span><\/li>\n<\/ul>\n<p>Whether you are creating <i><span style=\"font-weight: 400;\">\u201c<\/span><\/i><b><i>Field update<\/i><\/b><i><span style=\"font-weight: 400;\">\u201d <\/span><\/i><span style=\"font-weight: 400;\">or <\/span><i><span style=\"font-weight: 400;\">\u201c<\/span><\/i><b><i>Object creation<\/i><\/b><i><span style=\"font-weight: 400;\">\u201d <\/span><\/i><span style=\"font-weight: 400;\">events, you need to create a custom field with the field name <\/span><b><i>gaconnector_Google_Analytics_Client_ID <\/i><\/b><span style=\"font-weight: 400;\">under the Object that you need to create an event with. This is what GA Connector uses to tell which web visitor is associated with your event<\/span><\/p>\n<h2>Setting up the Google Analytics Client ID custom field<\/h2>\n<p><b>Note: <\/b>If you are using our <a href=\"https:\/\/login.salesforce.com\/packaging\/installPackage.apexp?p0=04t4I000000lF4W\">GA Connector Package<\/a>, you can skip creating the <i>Google Analytics Client ID<\/i> field if you are creating events for the following objects: <b><i>Lead, Account, Opportunity, Case, and Contact<\/i><\/b> since our package already creates the fields for you. If you&#8217;re creating events for objects that\u00a0are <strong>related<\/strong>\u00a0(See <a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/data_modeling\/object_relationships\">Salesforce object relationships<\/a>) to the previously mentioned objects. you can also skip creating the\u00a0<i>Google Analytics Client ID<\/i>\u00a0field.<\/p>\n<ol>\n<li><span style=\"font-weight: 400;\">In your Salesforce org, click <\/span><b>Setup <\/b><span style=\"font-weight: 400;\">&gt;<\/span><b> Object Manager<\/b><\/li>\n<li><span style=\"font-weight: 400;\">From the <\/span><b>Object Manager<\/b><span style=\"font-weight: 400;\"> page, select the object that you want to create an event with<\/span><\/li>\n<li><span style=\"font-weight: 400;\">From the sidebar, click <\/span><b>Fields &amp; Relationships<\/b><span style=\"font-weight: 400;\">. Click <\/span><b>New <\/b><span style=\"font-weight: 400;\">to create a custom field<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Choose <\/span><b>Text <\/b><span style=\"font-weight: 400;\">as your data type. (If you are pulling your GA Client ID value from another field, you can also select <\/span><b>Formula<\/b><span style=\"font-weight: 400;\">) and click Next<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Fill up the Field Label with any label that you prefer and the Length with 255<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Fill up the<\/span><b> Field Name <\/b><span style=\"font-weight: 400;\">with <\/span><b><i>gaconnector_Google_Analytics_Client_ID<\/i><\/b><\/li>\n<li><span style=\"font-weight: 400;\">Click Next and Save the field<\/span><\/li>\n<\/ol>\n<h2><b> Creating the Event<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">You can easily create and manage your custom events on the GA4 settings page on your <\/span><a href=\"https:\/\/app.gaconnector.com\/dashboard\/integration\/crm-to-ga4\"><span style=\"font-weight: 400;\">account dashboard<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">While on the settings page, click on <strong>Create New Event<\/strong><\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">On the pop-up form, enter the name of your event. This is the event name that will appear on GA4. The event name must start with a letter and only underscores and alphanumeric characters are allowed.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Select your event type and choose which Objects\/Fields you want to attach the event with from the dropdown.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">If the object or field has just been created in Salesforce, it may take a few minutes before it is available from the dropdown.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GA Connector comes with a built-in set of data points from standard objects that it automatically sends from Salesforce to Google Analytics, however, these data points are not always enough. You may want to send your own data points that are not part of a custom package.\u00a0 With GA Connector, you can create and send [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"_links":{"self":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/3017"}],"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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/comments?post=3017"}],"version-history":[{"count":7,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/3017\/revisions"}],"predecessor-version":[{"id":3036,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/3017\/revisions\/3036"}],"wp:attachment":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/media?parent=3017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/categories?post=3017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/tags?post=3017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}