on August 21, 2007 by Wolf in Web_Coding, Comments (4)

Adding Metatags to ZenCart

This is ME, Wolf Halton!

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

4 Comments

  1. 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

  2. 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.

  3. 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?

  4. 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.

Leave a comment

XHTML: Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv Enabled