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

4 Comments to Tag your URLs for Google Analytics directly in Salesforce.com

  1. [...] post:  Tag your URLs for Google Analytics directly in Salesforce.com …Share this on del.icio.usDigg this!Share this on RedditBuzz up!Stumble upon something good? Share it [...]

  2. Tag your URLs for Google Analytics directly in Salesforce.com …- SFWEBDESIGN.com on September 18th, 2009
  3. [...] View post:  Tag your URLs for Google Analytics directly in Salesforce.com … [...]

  4. Tag your URLs for Google Analytics directly in Salesforce.com … | Search Engine Optimization on September 18th, 2009
  5. What a fantastic post. I really love reading these kinds or articles. I can’t wait to see what others have to say.

  6. Lawana Sieber on September 16th, 2010
  7. It’s onerous to search out knowledgeable people on this subject, but you sound like you realize what you’re speaking about! Thanks

  8. Thanks to the recent laws which were passed the places where smoking is permitted is getting smaller and smaller on September 10th, 2011

Leave a comment