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. 

With GA Connector, you can create and send two types of events to GA4:

  • Object creation events
    E.g. when a new Account is created, an event will be sent to Google Analytics.
  • Field update events When a given field is updated, its new value will be sent to Google Analytics.

Whether you are creating Field updateor Object creationevents, you need to create a custom field with the field name gaconnector_Google_Analytics_Client_ID 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

Setting up the Google Analytics Client ID custom field

Note: If you are using our GA Connector Package, you can skip creating the Google Analytics Client ID field if you are creating events for the following objects: Lead, Account, Opportunity, Case, and Contact since our package already creates the fields for you. If you’re creating events for objects that are related (See Salesforce object relationships) to the previously mentioned objects. you can also skip creating the Google Analytics Client ID field.

  1. In your Salesforce org, click Setup > Object Manager
  2. From the Object Manager page, select the object that you want to create an event with
  3. From the sidebar, click Fields & Relationships. Click New to create a custom field
  4. Choose Text as your data type. (If you are pulling your GA Client ID value from another field, you can also select Formula) and click Next
  5. Fill up the Field Label with any label that you prefer and the Length with 255
  6. Fill up the Field Name with gaconnector_Google_Analytics_Client_ID
  7. Click Next and Save the field

Creating the Event

You can easily create and manage your custom events on the GA4 settings page on your account dashboard.

  1. While on the settings page, click on Create New Event
  2. 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.
  3. Select your event type and choose which Objects/Fields you want to attach the event with from the dropdown.

If the object or field has just been created in Salesforce, it may take a few minutes before it is available from the dropdown.