Version Notes
The extension execution depend on the css class "product-image" and "product-name" that is assigned to each product on the search result page.
Download this release
Release Info
Developer | Measured Search |
Extension | Site_Search_Analytics |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/community/Wisdmlabs/Measuredsearch/Helper/Data.php +32 -0
- app/code/community/Wisdmlabs/Measuredsearch/Model/msearch.php +8 -0
- app/code/community/Wisdmlabs/Measuredsearch/etc/config.xml +79 -0
- app/code/community/Wisdmlabs/Measuredsearch/etc/system.xml +49 -0
- app/design/frontend/base/default/layout/msearch/wisdmlabs_measuredsearch.xml +17 -0
- app/design/frontend/base/default/template/measuredsearch/addscript.phtml +90 -0
- app/design/frontend/base/default/template/measuredsearch/track_starttime.phtml +4 -0
- app/etc/modules/Wisdmlabs_Measuredsearch.xml +8 -0
- package.xml +28 -0
app/code/community/Wisdmlabs/Measuredsearch/Helper/Data.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Measured Search
|
4 |
+
*/
|
5 |
+
|
6 |
+
class Wisdmlabs_Measuredsearch_Helper_Data extends Mage_Core_Helper_Abstract
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* Config paths for using throughout the code
|
10 |
+
*/
|
11 |
+
const XML_PATH_ACTIVE = 'wdm_config/wdm_group/active';
|
12 |
+
const XML_PATH_APIKEY = 'wdm_config/wdm_group/apikey';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Whether Universal GA is ready to use
|
16 |
+
*
|
17 |
+
* @param mixed $store
|
18 |
+
* @return bool
|
19 |
+
*/
|
20 |
+
public function ms_apikey()
|
21 |
+
{
|
22 |
+
$apikey = Mage::getStoreConfig('wdm_config/wdm_group/apikey',Mage::app()->getStore());
|
23 |
+
return $apikey;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function ismeasuredsearchavailable()
|
27 |
+
{
|
28 |
+
$status = Mage::getStoreConfig('wdm_config/wdm_group/active',Mage::app()->getStore());
|
29 |
+
return $status;
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
app/code/community/Wisdmlabs/Measuredsearch/Model/msearch.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wisdmlabs_Measuredsearch_Model_msearch
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
7 |
+
|
8 |
+
?>
|
app/code/community/Wisdmlabs/Measuredsearch/etc/config.xml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
/**
|
3 |
+
* Measured Search Extension
|
4 |
+
* @package Wisdmlabs_MeasuredSearch
|
5 |
+
* @author WisdmLabs
|
6 |
+
*/
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<modules>
|
10 |
+
<Wisdmlabs_Measuredsearch>
|
11 |
+
<version>1.0</version>
|
12 |
+
</Wisdmlabs_Measuredsearch>
|
13 |
+
</modules>
|
14 |
+
|
15 |
+
<global>
|
16 |
+
<models>
|
17 |
+
<measuredsearch>
|
18 |
+
<class>Wisdmlabs_Measuredsearch_Model</class>
|
19 |
+
</measuredsearch>
|
20 |
+
</models>
|
21 |
+
<helpers>
|
22 |
+
<measuredsearch>
|
23 |
+
<class>Wisdmlabs_Measuredsearch_Helper</class>
|
24 |
+
</measuredsearch>
|
25 |
+
</helpers>
|
26 |
+
</global>
|
27 |
+
|
28 |
+
<frontend>
|
29 |
+
<routers>
|
30 |
+
<measuredsearch>
|
31 |
+
<use>standard</use>
|
32 |
+
<args>
|
33 |
+
<module>Wisdmlabs_Measuredsearch</module>
|
34 |
+
<frontName>measuredsearch</frontName>
|
35 |
+
</args>
|
36 |
+
</measuredsearch>
|
37 |
+
</routers>
|
38 |
+
<layout>
|
39 |
+
<updates>
|
40 |
+
<wisdmlabs_measuredsearch>
|
41 |
+
<file>msearch/wisdmlabs_measuredsearch.xml</file>
|
42 |
+
</wisdmlabs_measuredsearch>
|
43 |
+
</updates>
|
44 |
+
</layout>
|
45 |
+
</frontend>
|
46 |
+
|
47 |
+
<adminhtml>
|
48 |
+
<acl>
|
49 |
+
<resources>
|
50 |
+
<all>
|
51 |
+
<title>Allow Everything</title>
|
52 |
+
</all>
|
53 |
+
<admin>
|
54 |
+
<children>
|
55 |
+
<system>
|
56 |
+
<children>
|
57 |
+
<config>
|
58 |
+
<children>
|
59 |
+
<wdm_config>
|
60 |
+
<title>wisdmlabs - All</title>
|
61 |
+
</wdm_config>
|
62 |
+
</children>
|
63 |
+
</config>
|
64 |
+
</children>
|
65 |
+
</system>
|
66 |
+
</children>
|
67 |
+
</admin>
|
68 |
+
</resources>
|
69 |
+
</acl>
|
70 |
+
</adminhtml>
|
71 |
+
|
72 |
+
<default>
|
73 |
+
<wdm_config>
|
74 |
+
<wdm_group>
|
75 |
+
<active>1</active>
|
76 |
+
</wdm_group>
|
77 |
+
</wdm_config>
|
78 |
+
</default>
|
79 |
+
</config>
|
app/code/community/Wisdmlabs/Measuredsearch/etc/system.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<wdm_option translate="label" module="measuredsearch">
|
5 |
+
<label>Measured Search</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</wdm_option>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<wdm_config translate="label" module="measuredsearch">
|
11 |
+
<label>API Key Setting</label>
|
12 |
+
<tab>wdm_option</tab>
|
13 |
+
<sort_order>1000</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>1</show_in_website>
|
16 |
+
<show_in_store>1</show_in_store>
|
17 |
+
<groups>
|
18 |
+
<wdm_group translate="label" module="measuredsearch">
|
19 |
+
<label>Measured Search API Setting</label>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<sort_order>1000</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
<fields>
|
26 |
+
<active translate="label">
|
27 |
+
<label>Enable</label>
|
28 |
+
<frontend_type>select</frontend_type>
|
29 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
30 |
+
<sort_order>10</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
</active>
|
35 |
+
<apikey translate="label">
|
36 |
+
<label>API key </label>
|
37 |
+
<comment>Enter the API key of Measured Search Account</comment>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>20</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</apikey>
|
44 |
+
</fields>
|
45 |
+
</wdm_group>
|
46 |
+
</groups>
|
47 |
+
</wdm_config>
|
48 |
+
</sections>
|
49 |
+
</config>
|
app/design/frontend/base/default/layout/msearch/wisdmlabs_measuredsearch.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout version="0.1.0">
|
2 |
+
<catalogsearch_result_index>
|
3 |
+
<reference name="head">
|
4 |
+
<block type="core/template" name="measuredsearch_init_time" as="measuredsearch_init_time" template="measuredsearch/track_starttime.phtml" />
|
5 |
+
</reference>
|
6 |
+
<reference name="content">
|
7 |
+
<block type="core/text_list" name="msearch_before_body_end" as="msearch_before_body_end" />
|
8 |
+
</reference>
|
9 |
+
<reference name="msearch_before_body_end">
|
10 |
+
<block type="core/template" name="measuredsearch_add_script" as="measuredsearch_add_script" template="measuredsearch/addscript.phtml">
|
11 |
+
<block type="catalog/product_list_toolbar" name="product_list_toolbar" >
|
12 |
+
<block type="page/html_pager" name="product_list_toolbar_pager"/>
|
13 |
+
</block>
|
14 |
+
</block>
|
15 |
+
</reference>
|
16 |
+
</catalogsearch_result_index>
|
17 |
+
</layout>
|
app/design/frontend/base/default/template/measuredsearch/addscript.phtml
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$active = Mage::helper('measuredsearch')->ismeasuredsearchavailable();
|
3 |
+
if($active)
|
4 |
+
{
|
5 |
+
session_start();
|
6 |
+
if(! (isset($_GET['limit']) || isset($_GET['mode']) || isset($_GET['dir']) || isset($_GET['order'])))
|
7 |
+
{
|
8 |
+
$key = Mage::helper('measuredsearch')->ms_apikey();
|
9 |
+
$start_time=$_SESSION['start_time'];
|
10 |
+
$end_time=round(microtime(true) * 1000);
|
11 |
+
$latency=$end_time-$start_time;
|
12 |
+
$query = $this->helper('catalogsearch')->getQueryText();
|
13 |
+
$result=$this->getLayout()->getBlock("search.result")->getResultCount();
|
14 |
+
if($result)
|
15 |
+
{
|
16 |
+
$total= $this->getLayout()->getBlock('product_list_toolbar')->getTotalNum();
|
17 |
+
$first= $this->getLayout()->getBlock('product_list_toolbar')->getFirstNum();
|
18 |
+
$last= $this->getLayout()->getBlock('product_list_toolbar')->getLastNum();
|
19 |
+
$shown=($last-$first)+1;
|
20 |
+
$page=$this->getLayout()->getBlock('product_list_toolbar')->getCurrentPage();
|
21 |
+
}
|
22 |
+
else
|
23 |
+
{
|
24 |
+
$total=0;
|
25 |
+
$shown=0;
|
26 |
+
$page=0;
|
27 |
+
}
|
28 |
+
|
29 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
|
30 |
+
$user_id= Mage::getSingleton('customer/session')->getCustomer()->getId();
|
31 |
+
}
|
32 |
+
else
|
33 |
+
{
|
34 |
+
$user_id=0;
|
35 |
+
}
|
36 |
+
|
37 |
+
$session=Mage::getSingleton("core/session")->getSessionId();
|
38 |
+
|
39 |
+
echo "<div><script>var _msq = _msq || []; _msq.push(['track', {
|
40 |
+
key: '".$key."',
|
41 |
+
user: '".$user_id."',
|
42 |
+
session: '".$session."',
|
43 |
+
query: '".$query."',
|
44 |
+
shownHits: ".$shown.",
|
45 |
+
totalHits: ".$total.",
|
46 |
+
latency: ".$latency.",
|
47 |
+
pageNo: ".$page."
|
48 |
+
}]);(function() {
|
49 |
+
var ms = document.createElement('script'); ms.type = 'text/javascript';
|
50 |
+
ms.src = ('https:' == document.location.protocol ? 'https://www.' : 'http://') + 'measuredsearch.com/static/js/ms.js';
|
51 |
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ms, s);
|
52 |
+
})();</script>";
|
53 |
+
|
54 |
+
echo "<script src='http://code.jquery.com/jquery-latest.js'></script>";
|
55 |
+
echo "<script>jQuery(document).ready(function (){ jQuery('.product-image').click(function(){
|
56 |
+
var listitem= jQuery(this).closest('a').closest('li.item');
|
57 |
+
var pos= jQuery('li.item').index(listitem)+1;
|
58 |
+
var title=jQuery(this).closest('a').attr('title');
|
59 |
+
var url=jQuery(this).closest('a').attr('href');
|
60 |
+
var msg= _msq.push(['trackClick', {
|
61 |
+
key: '".$key."',
|
62 |
+
query: '".$query."',
|
63 |
+
position: pos,
|
64 |
+
cDocId: url,
|
65 |
+
cDocTitle: title,
|
66 |
+
pageNo: ".$page.",
|
67 |
+
shownHits: ".$shown.",
|
68 |
+
totalHits: ".$total."}]);
|
69 |
+
}); }); </script>";
|
70 |
+
|
71 |
+
echo "<script>jQuery(document).ready(function (){ jQuery('.product-name').click(function(){
|
72 |
+
|
73 |
+
var title=jQuery(this).find('a').attr('title');
|
74 |
+
var listitem= jQuery(this).closest('li');
|
75 |
+
var pos= jQuery('li.item').index(listitem)+1;
|
76 |
+
var url=jQuery(this).find('a').attr('href');
|
77 |
+
var msg= _msq.push(['trackClick', {
|
78 |
+
key: '".$key."',
|
79 |
+
query: '".$query."',
|
80 |
+
position: pos,
|
81 |
+
cDocId: url,
|
82 |
+
cDocTitle: title,
|
83 |
+
pageNo: ".$page.",
|
84 |
+
shownHits: ".$shown.",
|
85 |
+
totalHits: ".$total."}]);
|
86 |
+
}); }); </script></div>";
|
87 |
+
|
88 |
+
}
|
89 |
+
}
|
90 |
+
?>
|
app/design/frontend/base/default/template/measuredsearch/track_starttime.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
session_start();
|
3 |
+
$_SESSION['start_time']=round(microtime(true) * 1000);
|
4 |
+
?>
|
app/etc/modules/Wisdmlabs_Measuredsearch.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Wisdmlabs_Measuredsearch>
|
4 |
+
<active>true</active>
|
5 |
+
<codePool>community</codePool>
|
6 |
+
</Wisdmlabs_Measuredsearch>
|
7 |
+
</modules>
|
8 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Site_Search_Analytics</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Get detailed analytics for what your customers are searching for and whether they are finding what they need.</summary>
|
10 |
+
<description>Site Search Analytics for plugin allows you to keep track of what your customers are searching for and whether they are finding what they need.
|
11 |
+

|
12 |
+
Tons of revenue gets lost when people don't find what they are looking for or if your product is hidden on the 3rd page. Get all insights you need to understand whether your site is optimized for search and generate more product sales.
|
13 |
+

|
14 |
+
The site search analytics plugin is complemented by our mobile and web optimized dashboard that you can use to see all the reports.
|
15 |
+
The current version of the plugin supports the following features:
|
16 |
+

|
17 |
+
Top Searches & No Result Searches - Identify what your customers are searching for and what they are not finding, giving you an opportunity to engage them more.
|
18 |
+
Search Volume and Rate - Get data on your monthly, weekly and daily searches.
|
19 |
+
Search Performance - Get data on how long your searches are taking and trends on the performance metrics.
|
20 |
+
</description>
|
21 |
+
<notes>The extension execution depend on the css class "product-image" and "product-name" that is assigned to each product on the search result page.</notes>
|
22 |
+
<authors><author><name>Measured Search</name><user>measuredsearch</user><email>sameer@measuredsearch.com</email></author></authors>
|
23 |
+
<date>2013-08-24</date>
|
24 |
+
<time>07:37:16</time>
|
25 |
+
<contents><target name="magecommunity"><dir name="Wisdmlabs"><dir name="Measuredsearch"><dir name="Helper"><file name="Data.php" hash="399ff7cb6f22e6721e2f74efc500b2ad"/></dir><dir name="Model"><file name="msearch.php" hash="b37366e24cad736e6ce15edb648a8b8b"/></dir><dir name="etc"><file name="config.xml" hash="4860452b5c53cb6815214edb5ab01b90"/><file name="system.xml" hash="342b947d2e3ed05163273999b6907077"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="msearch"><file name="wisdmlabs_measuredsearch.xml" hash="b3258d084639649458e50ebbcceb7c72"/></dir></dir><dir name="template"><dir name="measuredsearch"><file name="addscript.phtml" hash="b40a7e2ea6f6e559f0a7455e26b153db"/><file name="track_starttime.phtml" hash="cab33082dad29a4f9698bf3d410811ad"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wisdmlabs_Measuredsearch.xml" hash="5d2aeba780c95feb410acdfd6de8b755"/></dir></target></contents>
|
26 |
+
<compatible/>
|
27 |
+
<dependencies><required><php><min>5.3.4</min><max>5.5.1</max></php></required></dependencies>
|
28 |
+
</package>
|