Google analytics provides in-depth data into who’s visiting your website and what they are doing once they are there. If you have not already set up a Google Analytics account, you’ll need to do so.
- Once you have your Google Analytics code log into your OpenCart Dashboard
- Go to System > Settings
- Choose your store and click “edit”
- Go to the server tab and scroll to the bottom
- Find the Category for Google Analytics Code and paste your code in the text box If you are not familiar how to get your Google Analytics code please see our article on Installing Google Analytics
- Click “Save”
You’ve now added Google Analytics to your OpenCart Website and Google can start collecting data about your website’s visitors. If you need further assistance please feel free to ask a question on our support center website.
Good way to add code Google Analytics for Opencart from 1x – 2x
=> https://www.obinb.com/2016/05/huong-dan-cach-gan-google-analytics-vao.html
Thanks for your useful information sharing here.
Appreciable Job..
I tried pasting the google analytics java script code under extensions>analytics
but I am getting the following error
Undefined index: store_id in /customers/7/a/1/(mydomainname).com/httpd.www/admin/controller/analytics/google_analytics.php on line 13Warning: Cannot modify header information – headers already sent by (output started at /customers/7/a/1/(mydomainname).com/httpd.www/admin/controller/startup/error.php:34) in /customers/7/a/1/(mydomainname).com/httpd.www/system/library/response.php on line 12
What does this mean and how do I rectify this? Please help
It’s possible you placed the code in a spot that disrupted the PHP code. The error you are seeing is a PHP error.
Hi buddies,
This is a very simple and easy way to add the google analytics code to opencart and i just did it all like discribed, however when i was thinking that it was simple and fast google comes with “Status: Tracking Not Installed
Hello Vitor,
This seems to be an issue with OpenCart. Arnel mentioned above that there is a thread with a solution for this. Try that and see if that helps. He also provided a link to a plugin that may also help.
Kindest Regards,
Scott M
Hi Arnel
I realised my mistake?!! I just pasted the tracking id not the whole code! no wonder it wasnt picking up. It should work now.
Thanks for your feedback as well. appreciated
Regards
Pal
I am using OC1.5.6 and I have inserted my GA code in the server tab section, unfortunately Google tells me there is a missing tracking code -> No valid tracking code found for property.
Hello Pal,
Sorry for the problems with the Google Analytics. Apparently, the problem has also been seen by other OpenCart users. They posted a solution here. There is also a plugin that could make this easier as well. The plugin can be found here.
Regards,
Arnel C.
Hi There,
So pasting the google analytics code into the text box will apply google analytics to the entire website?
On the Google analytics page it says “This is your tracking code. Copy and paste it into the code of every page you want to track.”
Hello Alex,
Thank you for your comment. For many Content Managment Systems (CMS), you will just have to add the Google code to the Dashboard, or use a plugin. It will then add the code to the pages.
Since OpenCart is built in PHP (like many CMS’s), most of the pages are created dynamically. Meaning they are generated as needed, and there is no “static” page to add a tracking code to.
If you have any further questions, feel free to post them below.
Thank you,
John-Paul
Thanks a million.
Enquiry:
Why cant I install Google Analytics in my site.
It keeps on diverting me to error page
that says:
Forbidden
You don’t have permission to access /admin/index.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request
Hello Laarnibebe,
Sorry to hear that you are having a problem with the Google Analytics installation. Usually, when you see an error of this nature it means that the directory (or folder) mentioned in the error has a permission setting that does not allow you to make that change. This could also be a server security rule. You will need to check permissions for that folder and/or consult with your server support team in order to determine why you cannot install the module.
I’m really new to building an online store and articles like these are so useful for a rookie like myself! I created a Google Analytics account and had no clue what to do after that (lol) so I searched for “where to add google analytics code in opencart” and this brilliant article was the 1st hit which I followed. I’m in the final stages of completing my website, and articles like these save me so much time which I can use to finalise my website instead of figuring out “code”.
Thank you.
No improvement needed. This was the best, most straight-forward instruction and I was able to do it minutes. Thank you so much!!