function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rocio VivancoRocio Vivanco 

How to embed a Google Analytics tracking code in a Visualforce page?

Hi all,

I don't know if this is the suitable place to post this thread.
I have to embed a Google Analytics code to my Visualforce page. The VF page is already published on the Web through a created site.

I added the GA code between the <script> </script> in the head tag in the visualforce this way:
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  ga('create', 'UA-mycode-1', 'auto', {'allowLinker': true});
  ga('require', 'linker');
  ga('linker:autoLink', [''] );

The Visualforce URL is something like this:
Is the GA code embedded in my Visualforce correct?, especially:

1. Is the domain name in the last line correct?
2. Is there something missing there?. The aim is to get the VF page tracked.

I would appreciate any help.

Srinivas d 7Srinivas d 7