tag

Tag your URLs for Google Analytics directly in Salesforce.com

Here is a quick hack that can allow you to generate Google Analytics Tagged URL straight from a Campaign in Salesforce.com (SFDC) instead of going back and forth from SFDC and Google Analytics URL builder. More over, it allows you to standardize your tags.

Follow those 2 easy steps:

  1. Create a custom picklist field for each of the fields* you normally use to tag your URLs with Google URL builder.
  2. Create a custom formula fields that will actually build the tagged URL for you. Use the following generic formula by replacing each ___ with the SFDC field name:
    “?utm_source=”+___+”&utm_medium=”+___+”&utm_term=”+___+”&utm_content=”+___+”&utm_campaign=”___

And Voilà! You now have a Tagged URL ready to be added at the end of your destination URL.

*Tag URLs allow you to use the following 5 fields (bold fields are mandatory):

  • Campaign Source (utm_source)
  • Campaign Medium (utm_medium)
  • Campaign Term (utm_term)
  • Campaign Content (utm_content)
  • Campaign Name (utm_campaign)

Here is an example of how I did it for a customer:

I only used the 3 mandatory fields for Google URL tagging: Campaign Source, Campaign Medium and Campaign Name (See below screenshot).

  1. I used the SFDC Campaign ID as the Campaign Name (but you could also use the Campaign Name)
  2. I used the standard field “Type” for the Campaign Medium
  3. I created a custom picklist field called “Source” for the Campaign Source”Source” in which I have listed all my differents ads sources.
  4. I used the following formula*:
    “?utm_source=”+TEXT(Source__c) +”&utm_medium=”+TEXT(Type)+”&utm_campaign=”+ Id

* Don’t forget if you use a picklist fields to add the function “TEXT” in order to get the actual picklist value.

Tags: , , , ,

Thursday, September 17th, 2009 Lead Management, Salesforce.com 3,933 Comments