<img src="abc.png" />
call to replace anchor tags contains '/admin' in href

Google Tag Manager

Google Tag Manager(GTM) is a tag management system that allows you to quickly and easily update tags and code snippets on your website or mobileapp, such as those intended for traffic analysis and marketing optimization. You can add and update AdWords, Google Analytics, Firebase Analytics, Floodlight, and 3rd party or custom tags from the Tag Manager user interface instead of editing site code. This reduces errors and frees you from having to involve a developer when configuring tags.

A tag is a snippet of code that sends information to a third party, such as Google. If you don't use a tag management solution such as Tag Manager, you need to add these snippets of code directly to files on your website or mobile app.

Setting up

  1. Go to Google Tag Manager to create an account and click Sign up.

  2. The following window will appear to set up your account.

  3. Mention your account name and select the provided checkbox. Click Continue.

  4. Now create a container for your site in the account.

  5. Fill up the Container name and choose where to use the container. Click Create

  6. Click Yes on the pop up of Google Tag Manager Terms of Service Agreement.

  7. Now we have the code snippet of GTM.

  8. Copy the GTM id and click OK.

Configure GTM on StoreHippo

Follow these simple steps to configure Google Tag Manager on StoreHippo.

  1. Go to Settings > Site Settings in StoreHippo Admin Panel.

  2. Mention your GTM id which you got from the previous step.

Verifying GTM

After you have configured your store on GTM, you can verify it that it is going well.

Go to Google Tag Manager and select your container name. The following window will appear:

You can add new tags by clicking on Add a new tag. A window will appear where you can add the tags by choosing from over 50 tag types.
For more information, refer Google Tag Manager overview.

Custom Events

Google Tag Manager provides a globalvariabledataLayer,that can be used to trigger custom events

dataLayer.push({'event': 'event_name'});


dataLayer = [{
    'pageCategory': 'signup',
    'visitorType': 'high-value'

StoreHippo is event-based, so every user action or internal action is events based. So you can put your custom code in the event handlers.

window.ms.bind("ms.page_change_start", function (event) {
    if (event && event.data && event.data.to.indexOf("checkout") > -1 && event.data.from.indexOf("cart") > -1) {
        if (parseInt(window.ms.cart.sub_total) < parseInt(window.ms.settings.minimum_order_value)) {
            window.ms.broadcast('ms.msg.minimum_order_value_required', {
                level: 'error',
                data: {minimum_value: window.ms.settings.minimum_order_value}

Add To Cart

window.ms.bind('ms.entity.carts.add_product_success', function (event) {
    var product = event.data.data.product;
        'event': 'addToCart',
        'ecommerce': {
            'currencyCode': ms.user.currency.name,
            'add': {                                // 'add' actionFieldObject measures.
                'products': [
                    {                        //  adding a product to a shopping cart.
                        'name': product.name,
                        'id': product.sku,
                        'price': product.price,
                        'brand': product.brand,
                        'category': product.category,
                        'quantity': 1


Q. How can be new GTM events added?

The new GTM events can be added in StoreHippo with the help of startup scripts. Startup scripts allow you to add behaviours like GTM events in StoreHippo. For example:

GTM adds an item when a product is added to cart

app.addPosthook({entity: "ms.carts", command: "addItem"}, function (req, res, next) {
    var product = res.data.product;
        'event': 'addToCart',
        'ecommerce': {
            'currencyCode': ms.user.currency.name,
            'add': {
                'products': [
                        'name': product.name,
                        'id': product._id,
                        'price': product.price,
                        'brand': product.brand,
                        'category': product.categories,
                        'variant': product.variant_id,
                        'quantity': product.quantity
Q. What are GTM events that are supported by StoreHippo?

The GTM events supported currently by StoreHippo are:

  • Product Impressions
  • Product Clicks
  • Product Detail Impressions
  • Add / Remove from Cart
  • Checkout
  • Purchases