• Srinivas d 7
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
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:
 
<script>
 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

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

</script>
The Visualforce URL is something like this:
 
https://mycompany.secure.force.com/myfolder/myvisualforcepage
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.

 
Hi,

I'm trying to get a child field with SOQL, but I not have success.

I must get the fields of Object Account and Object Product_Account (Child of Account).

I write A query like this:

LIST<Account> accounts = [SELECT Account.Name, (SELECT Product_Account__c.Status__c FROM Product_Account __r) FROM Account];
for(Account account : accounts){
 System.debug('Account Name: ' + account.Name + ', Product Name: '+ HERE I WANT GET THE VALUE FROM "Product_Account__c.Status__c" FIELD);
}

Is it possible to do?

Thanks
Rafael