Adding web counter to Shop-Script storefront

Google Analytics

Webasyst framework offers built-in integration with the Google Analytics service; therefore, to connect it to your website, simply enter your Google Analytics Property ID (provided in the form UA-123456-1) in the appropriate field in the “Site” app's settings.

Google Analytics integration setting

How to add other web counters

1. Creation of a block with counter code

A web counter is provided by popular online services (such as EasyCounter, StatCounter, etc.) as a portion of JavaScript code which should be embedded in the source code of your website pages.

In the Webasyst framework it is convenient to organize such code snippets as common blocks.

  1. In the Site application open the “Blocks” section.
  2. Create a new block, enter an ID (Latin letters, digits, and underscore characters are accepted) and arbitrary description for the new block.
  3. To avoid curly brackets used in JavaScript from being inadequately processed by the Smarty engine, add the following lines to the block source code editing area:
  4. Insert your counter code between these two lines and save the block.

2. Embedding counter in storefront templates

Once you save the block, an automatically generated line of code (helper) will appear in its upper panel, which you can use to embed your block in any frontend pages or templates of any Webasyst applications.

To get a web counter triggered on all website (storefront) pages, add that helper in design theme template index.html; for example, as shown in the picture below:

If you need to add counter code only inside the <head></head> section, you may simply paste it into field “Custom JavaScript code” in the “Settings” section of the “Site” app, without {literal}...{/literal} tags.


    Add comment

    To add a comment please sign up or login