I have customer portal enabled on my org. I want to add google analytics to it. Is this possible? If yes, How can i do this?

  • does your portal use the standard pages or visualforce pages ? – Samuel De Rycke Jan 28 '14 at 10:15

It is possible.

Your customer portal works as any other site for Google analytics.

You only have to add the javascript snippet that Google Analytics gives you when you are configuring your account.

It is always a good idea to put this code on a component to include into all your site pages. Also you could use templates to add it to all pages at once.


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXX-X']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);


More information

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.