on August 21, 2007 by Wolf in Web_Coding, Comments (10)
Adding Metatags to ZenCart
Adding Google-analytics to a zencart
Google gives you 2 ways to verify that you own the site:
- Put a special html page on the site
- Put a special metatag on the index page.
ZenCart automatically makes all 404 “page not found” requests go to the home page or index, so Google says they cannot use method #1 to verify my site. Method #2 is difficult on PHP sites because the source-code is not the same as what you see when you click on the “view page source” button. So with some research on http://www.zen-cart.com/forum/ I found out exactly where to make the changes to get the GoogleAnalytics to work.
You will see that this is not exactly intuitive.
In the site/includes/language/english/meta-tags.php
I edited the following lines:
// page title
define(‘TITLE’, ‘Halton Security Institute, Network Defense Section’);// Site Tagline
define(‘SITE_TAGLINE’, ‘Now, You Don Not Have to Just Hope Your Systems are Secure’);// Custom Keywords
define(‘CUSTOM_KEYWORDS’, ‘Network security, open source, ecommerce, Wolf Halton’);// Review Page can have a lead in:
define(‘META_TAGS_REVIEW’, ‘Reviews: ‘);..and placed this line in below
//Wolfs attempt to add GoogleAnalytics
define(‘META_TAG_VERIFY-VL’, ‘Whatever Google says this value should be’);
Now there is a file called: site/includes/templates/YOUR_TEMPLATE/common/html_header.php and I can put a tag into it that calls the variable I just put into the file above, however I could also put the <meta name=”verify-v1″ content=”Whatever Google says it should be” /> directly in there, and it will show up on the source for the page.
This seems a more straightforward way to place the tag than to make a variable for it, and it also guarantees that google won’t see the tag 1000 times on the site. Now I get to see if Google can see my hack.
The answer: You’ve successfully verified http://networkdefense.biz/.
Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList
Drew
November 17, 2008 @ 6:13 pm
//Wolfs attempt to add GoogleAnalytics
define(’META_TAG_VERIFY-VL’, ‘Whatever Google says this value should be’);
do you mean: ’META_TAG_VERIFY-V1’ or is it really VL…
I can’t get this to work… I have a ZENCART site. Really wish it had GA running on it.
Please help…
Drew
Wolf
November 22, 2008 @ 5:12 pm
The first part is a hack that puts the google-link in as a metatag on every page that calls the header info, and is a literal pull from my research on the forums, however the second way is (if I recall correctly) how I actually handled it. If you go ahead and add the variable META_TAG_VERIFY-VL with content that I put above as being “Whatever Google says to put here,” and then copy the proper syntax and format of the line that will call a variable on the header file ’site/includes/templates/YOUR_TEMPLATE/common/html_header.php’ you have to make sure it is the same variable name in both the define statement and the call statement. I don’t remember why I didn’t include that piece in the article. What I ended up doing was just making a (consider the % to be the same as a right or left arrow. WordPress won’t let me write html code in the comment field)
Why not put both metatag contents in your html_header.php file, under the existing metatags?
%meta name=”verify-v1? content=”Whatever Google says it should be” /%
and
%meta name=”verify-vl? content=”Whatever Google says it should be”
The “whatever Google says…” part is the string Google has linked to your analytics account. For security reasons, and because I can’t remember it, I am not publishing mine in plain text on the web site.
SEO
May 4, 2010 @ 1:53 am
Great info. Didn’t know what it was until I googled it and this site comes up. Can I erase the meta tag verify-vl? And will google “replace” it?
Wolf
May 4, 2010 @ 11:08 am
@SEO Google doesn’t change anything on your site. If you erase the verification code, it stays gone. BTW, this was true 2 years ago, but it may be different today.
Gulam Ali
December 16, 2010 @ 12:14 am
Thanks for the effort you took to expand upon this post so thoroughly.
Why valid html code is important to your web site’s search engine optimization efforts and consequent high rankings! Such invalid html codes… A single missing bracket in your html code can be the cause your web page cannot be found in search engines… Providentially, there are free services that allow you to check and fix the validity of your html codes.
Wolf
December 16, 2010 @ 4:46 pm
Thanks for the resource, Gulam Ali.
iMacker
February 9, 2011 @ 4:12 pm
The simplest way without even using a mod is this method found here http://surreystore.com/Forums/joomla-help/zencart-google-analytic-integration/
Brian P
February 16, 2011 @ 12:44 pm
I am trying to make changes on my zen cart but this is really hard man! I would have to say this is not the most friendly script I have worked with.
waqas malik
November 15, 2011 @ 1:51 pm
But adding google analytic in header may slow down the site!!!!!!!!
Is not it better to add it in footer.tpl in current working template?:(
Wolf
December 13, 2011 @ 10:45 pm
Waqas Malik: Why would hitting the code in the header be any different than in the footer?