In this example I am going to create a link to google search console to get history of keywords used and organic position in the last 3 months for a url in your xcart 4 store from the backend. In order to do this you must have your domain verified and setup in google search console and be logged into your account.
The structure of the link to google search console is
https://search.google.com/search-console/performance/search-analytics
with the following get elements
resource_id=sc-domain%3Ayourdomain.com
hl=en
breakdown=query
page=!https%3A%2F%2Fwww.3Ayourdomain.com%2Fpage.html%2F
metrics=CLICKS%2CIMPRESSIONS%2CPOSITION
So an example is
https://search.google.com/search-console/performance/search-analytics?resource_id=sc-domain%3Apinakin.me.uk&hl=en&breakdown=page&metrics=CLICKS%2CIMPRESSIONS%2CPOSITION&page=!https%3A%2F%2Fpinakin.me.uk%2Fcommenting-out-code-using-liquid-in-shopify%2F
In xcart 4 we want to show link in the products list and category lists pages
edit /include/func/func.category.php
//in the function definition //function func_get_categories_list //after if ($category['is_icon'] && !empty($active_modules['Flyout_Menus']) && $config['Flyout_Menus']['icons_mode'] == 'E' && $config['Flyout_Menus']['icons_icons_in_categories'] >= $category_level ) { $thumb_url = func_image_cache_get_image("C", "catthumbn", $category["imageid"]); if (!empty($thumb_url)) { $category["thumb_url"] = $thumb_url["url"]; $category["thumb_x"] = $thumb_url["width"]; $category["thumb_y"] = $thumb_url["height"]; unset($thumb_url); } } //add $category['cleanurl'] = func_clean_url_get('C', $category['categoryid']);
edit /admin/category_products.php
//replace if (is_array($products)) { foreach ($products as $k=>$v) { $products[$k] = func_array_merge($v, func_query_first("SELECT main, orderby FROM $sql_tbl[products_categories] WHERE productid='$v[productid]' AND categoryid='$cat'")); } $smarty->assign("navigation_script","category_products.php?cat=$cat&sort=$sort&sort_direction=".intval($sort_direction)); } //wth if (is_array($products)) { foreach ($products as $k=>$v) { $products[$k] = func_array_merge($v, func_query_first("SELECT main, orderby FROM $sql_tbl[products_categories] WHERE productid='$v[productid]' AND categoryid='$cat'")); $products[$k]['cleanurl'] = func_clean_url_get('P', $v['productid']); } $smarty->assign("navigation_script","category_products.php?cat=$cat&sort=$sort&sort_direction=".intval($sort_direction)); }
edit /skin/common_files/admin/main/categories.tpl
replace <td><a href="categories.php?cat={$catid}"><font class="{if $c.avail eq "N"}ItemsListDisabled{else}ItemsList{/if}">{$c.category}</font></a></td> with <td><a href="categories.php?cat={$catid}"><font class="{if $c.avail eq "N"}ItemsListDisabled{else}ItemsList{/if}">{$c.category}</font></a> {if $c.cleanurl} <a href="https://search.google.com/search-console/performance/search-analytics?resource_id=sc-domain%3Atheoempartsstore.com&hl=en&breakdown=query&page=!{$c.cleanurl|escape:'url'}&metrics=CLICKS%2CIMPRESSIONS%2CPOSITION" target="_blank"><i class="lni lni-graph"></i></a>{/if} </td>
edit /skin/common_files/main/products.tpl
replace <td width="100%">{if $products[prod].main eq "Y" or $main ne "category_products"}<b>{/if}<a href="product_modify.php?productid={$products[prod].productid}{if $navpage}&page={$navpage}{/if}">{$products[prod].product}</a>{if $products[prod].main eq "Y" or $main ne "category_products"}</b>{/if} </td> with <td width="100%">{if $products[prod].main eq "Y" or $main ne "category_products"}<b>{/if}<a href="product_modify.php?productid={$products[prod].productid}{if $navpage}&page={$navpage}{/if}">{$products[prod].product}</a>{if $products[prod].main eq "Y" or $main ne "category_products"}</b>{/if} {if $products[prod].cleanurl} <a href="https://search.google.com/search-console/performance/search-analytics?resource_id=sc-domain%3Atheoempartsstore.com&hl=en&breakdown=query&page=!{$products[prod].cleanurl|escape:'url'}&metrics=CLICKS%2CIMPRESSIONS%2CPOSITION" target="_blank"><i class="lni lni-graph"></i></a>{/if} </td>