Location of Google Analytics code in Magento site

Hi everyone,

I have the following script on the pages of my site:

  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  ga('create', 'UA-50223530-1', 'mysite.com');
  ga('send', 'pageview');


Open in new window

I've done a complete site search for the above script but cannot find it anywhere in my site files within my Magento built site. I wondered if anyone could tell me where this code being generated from?

Really appreciate any help.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Couple of question... Where does it appear in the view source of the HTML documents?  How did you search  the site or site files - what search string, what libraries, etc?  I'm guessing it's part of a template document, but if we know more about what you've tried we may be better able to help figure it out.
Clark KentSoftware Engineer cum BloggerCommented:

Google Analytics is by default provided with Magento, you don't need to add the code yourself. Just go to System > Configuration > Google API > Google Analytics, select the right type, specify your Account Number and you're good to go.

If you want to update the existing code, then follow this path : yourtheme/default/template/googleanalytics/ga.phtml

I hope it will be works for you.

Thanks & regards
Clark Kent
gwh2Author Commented:
Thanks for the replies,

@Ray Paseur: The code I posted appears just before the closing head tag. There's also another Google Analytics code block just after the opening body tag and that one is being generated dynamically using the Magento Admin Panel at the path indicated by @Clark Kent. So the first block in the head tag is the one that I need to remove as I don't need it any more. I searched the site files both in my local site using Adobe Dreamweaver and I also searched the files on the remote server of the web host. I used UA-50223530-1 as the search string.

Is the above information helpful for you to assist further?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Clark KentSoftware Engineer cum BloggerCommented:
Hi gwh2,

Please check the Miscellaneous HTML file. Might be google analytic code in it.
gwh2Author Commented:
Hi, can you let me know the path to the miscellaneous html file? I searched for miscellaneous.html using dreamweaver but there were no search results.
Clark KentSoftware Engineer cum BloggerCommented:

Please follow this path : System >> Configuration >> Design >>  Miscellaneous HTML I hope it will works for you

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gwh2Author Commented:
@Clark Kent - thank you so much. That is where the code was found. I really appreciate your help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.