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 update” or “Object creation” events, 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.
- In your Salesforce org, click Setup > Object Manager
- From the Object Manager page, select the object that you want to create an event with
- From the sidebar, click Fields & Relationships. Click New to create a custom field
- 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
- Fill up the Field Label with any label that you prefer and the Length with 255
- Fill up the Field Name with gaconnector_Google_Analytics_Client_ID
- 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.
- While on the settings page, click on Create New Event
- 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.
- 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.