One of the common requirements is to update Opportunity Amount or similar currency field only when a certain stage is reached.
For example, you may only want to send Opportunity Amount to GA when the Opportunity reaches a stage “Closed Won”.
To achieve that, you can do the following:
- Create a formula field “Closed Won Amount”, that will return
- zero when the Stage is anything except “Closed Won”
- Opportunity Amount when Opportunity Stage is “Closed Won”
- Configure GA Connector package to send “Closed Won Amount” field to GA. This way, before Stage reaches “Closed Won”, GA Connector won’t send anything (because it will be zero). And when the Stage is changed to “Closed Won”, “Closed Won Amount” will become same as “Amount”. GA Connector package will pick up this update and send it to Google Analytics.
Here is how you can implement this:
Go to Salesfore – Setup – Opportunities – Fields, and click on “New”
Select Data Type = “Formula”
Click on “Next”
Select Return Type = “Currency”, and call the field “Closed Won Amount”
Click on “Next”
Paste the following formula, and click on “Check Syntax”
IF(TEXT(StageName)=”Closed Won”, Amount, 0)
Click on “Next” and finish setting up field security and layout
You can leave everything by default or consult your Salesforce Admin if you’re not sure about the following steps.
Go to Setup – Customize – Opportunities – Fields, and copy the API name of the field you have just created
You’ll need it to complete the following steps.
Click on the plus sign in the top right corner
Select “GA Connector Update Request Settings”
Click on “New”
Fill out the settings according to the instructions below
- Give a name “Opportunity Closed Won” (or any other that you prefer).
- Fill out “CID Field API Name” with the API name of your GA Client ID field.
- Select the index of the custom metric that GA Connector will send this field to. You may need to create this metric in Google Analytics
- Set “Field API Name” to the API name of the “Closed Won Amount” field (you copied this API name a few steps before).
- Select Field Type = “cm”
- Set Object Name = “Opportunity”
Now GA Connector will start sending the Opportunity Amount field for Opportunities that are Closed Won!