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

    Posted on

  • 2 comments

    1. Drew Nov 17

      //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 Nov 22

      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.

    Leave a reply

    ss_blog_claim=76bf26224b343b8b93e973cd09df450e ss_blog_claim=76bf26224b343b8b93e973cd09df450e