Skip to content

Commit 7a47dcb

Browse files
committed
Refactor Tracker
1 parent 13d7884 commit 7a47dcb

File tree

3 files changed

+22
-36
lines changed

3 files changed

+22
-36
lines changed

app/code/community/PiwikMage/PiwikAnalytics/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<config>
1616
<modules>
1717
<PiwikMage_PiwikAnalytics>
18-
<version>1.1.5.0</version>
18+
<version>1.1.6.0</version>
1919
</PiwikMage_PiwikAnalytics>
2020
</modules>
2121
<global>

app/design/frontend/base/default/template/piwikanalytics/piwik.phtml

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,13 @@
1919

2020
if ($siteId) {
2121

22-
/*path for noscript should take unadultered path*/
23-
$bugPath = $installPath;
24-
25-
if (strpos($installPath, "https://") !== false) {
26-
$secureinstallPath = $installPath;
27-
$installPath = str_replace("https://", "http://", $installPath);
28-
}
29-
if (strpos($installPath, "http://") === false)
30-
$installPath = "http://" . $installPath;
31-
32-
$secureinstallPath = str_replace("http://", "https://", $installPath);
33-
34-
$last = $installPath[strlen($installPath)-1];
35-
36-
if ($last != "/") {
37-
$installPath .= "/";
38-
$secureinstallPath .= "/";
39-
}
22+
/*remove https or https*/
23+
$installPath = preg_replace('#^https?:#', '', $installPath);
24+
4025

4126
// 0 Search Results
4227
if($this->getRequest()->getControllerName()=='result') {
43-
$nores = Mage::helper('catalogsearch')->getEngine()
28+
$noRes = Mage::helper('catalogsearch')->getEngine()
4429
->getResultCollection()
4530
->addSearchFilter(Mage::helper('catalogsearch')
4631
->getQuery()
@@ -53,16 +38,17 @@
5338
<script type="text/javascript">
5439
//<![CDATA[
5540
var _paq = _paq || [];
56-
(function(){ var u=(("https:" == document.location.protocol) ? "<?php echo $secureinstallPath ?>" : "<?php echo $installPath ?>");
57-
_paq.push(['setSiteId', <?php echo $siteId ?>]);
41+
(function(){
42+
var u="<?php echo $installPath ?>";
43+
_paq.push(['setSiteId', <?php echo $siteId ?>]);
5844
_paq.push(['setTrackerUrl', u+'piwik.php']);
5945
<?php echo $this->_getEcommerceCartUpdate()?>
6046
<?php echo $this->_getOrdersTrackingCode()?>
6147
<?php echo $this->_getProductPageview()?>
6248
<?php echo $this->_getCategoryPageview()?>
6349

64-
<?php if (isset($nores)): ?>
65-
_paq.push(['setCustomUrl', '' + document.URL + '&search_count=<?php echo $nores ?>']);
50+
<?php if (isset($noRes)): ?>
51+
_paq.push(['setCustomUrl', '' + document.URL + '&search_count=<?php echo $noRes ?>']);
6652
<?php endif ?>
6753

6854
<?php
@@ -77,7 +63,7 @@
7763
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js';
7864
s.parentNode.insertBefore(g,s); })();
7965
</script>
80-
<noscript><p><img src="<?php echo $bugPath ?>piwik.php?idsite=<?php echo $siteId ?>" style="border:0" alt="" /></p></noscript>
66+
<noscript><p><img src="<?php echo $installPath ?>piwik.php?idsite=<?php echo $siteId ?>" style="border:0" alt="" /></p></noscript>
8167
<!-- END PIWIK TRACKING CODE -->
8268

8369
<?php } ?>

package.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<package>
33
<name>Piwik_Ecommerce</name>
4-
<version>1.1.5</version>
4+
<version>1.1.6</version>
55
<stability>stable</stability>
66
<license uri="@license http://www.gnu.org/licenses/gpl-3.0.html">GPL v3</license>
77
<channel>community</channel>
@@ -26,27 +26,27 @@ Version 1.1.0 Adds support for 404 tracking&#xD;
2626
&#xD;
2727
Version 1.1.1 Adds support for 404 tracking via noroute&#xD;
2828
&#xD;
29-
Version 1.1.2 thanks to Chris and Sprankhub for various commits, code improvements and German Locale&#xD;
29+
Version 1.1.2 Thanks to Chris and Sprankhub for various commits, code improvements and German Locale.&#xD;
3030
&#xD;
31-
Version 1.1.3 Now using Piwik Async code thanks to commits from codedge&#xD;
31+
Version 1.1.3 Now using Piwik Async code thanks to codedge&#xD;
3232
&#xD;
33-
Version 1.1.4 Fix title encoding, thanks to Simon&#xD;
33+
Version 1.1.4 Simon fix on Github for better title tracking&#xD;
3434
&#xD;
35-
Version 1.1.5 Fix SKU encoding, thansks to Simon&#xD;
35+
Version 1.1.5 Simon fix on Github for better SKU tracking&#xD;
36+
&#xD;
37+
Version 1.1.6 Refactor tracker&#xD;
3638
&#xD;
3739
**You can use permissions to give any role&#xD;
3840
access to the Piwik iframe***&#xD;
3941
&#xD;
4042
&lt;p&gt;After install, make sure you clear your cache. Click &lt;strong&gt;&lt;a href="http://www.statstory.com/piwik-ecommerce-extension-for-magento/"&gt;here&lt;/a&gt;&lt;/strong&gt; for more details on how it works and how to install.&lt;/p&gt;</description>
41-
<notes>Piwik Search "No Search" results data in Piwik via noroute&#xD;
42-
&#xD;
43-
Source code Available at: https://github.com/adriansonline/Piwik-for-Magento&#xD;
43+
<notes>Source code Available at: https://github.com/adriansonline/Piwik-for-Magento&#xD;
4444
&#xD;
4545
</notes>
4646
<authors><author><name>Adrian Speyer</name><user>AdrianSpeyer</user><email>[email protected]</email></author></authors>
47-
<date>2012-12-14</date>
48-
<time>00:56:46</time>
49-
<contents><target name="mage"><dir name="."><dir name="app"><dir name="code"><dir name="community"><dir name="Mage"><dir name="PiwikAnalytics"><dir name="Block"><file name="Piwik.php" hash="e16a55e9e40d92fe635c6c86068310be"/></dir><dir name="Helper"><file name="Data.php" hash="652a0bb28db2540bd9ff0a5d933aabb5"/></dir><dir name="Model"><file name="Observer.php" hash="35d02dd4b55cc31d6b0e0b91811fa9aa"/></dir><dir name="controllers"><file name="IndexController.php" hash="eeb0eac61fc69189bb338c83b207cbc2"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f0b97990e63703f600c07b0db2a8eb39"/><file name="config.xml" hash="58c8f3a8b32bf23c370adc8227bd5dbd"/><file name="system.xml" hash="c541d79a21222ec70745c1cd40e9a144"/></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="piwikanalytics"><file name="piwik.phtml" hash="ac2cd5b90ceb7c1156cd9a93a4c0e62d"/></dir></dir><dir name="layout"><file name="piwikanalytics.xml" hash="0ecc6b445f0457ccec40259fee63c348"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="piwikanalytics.xml" hash="5fd829980f2dcfd818971842a99606c6"/></dir></dir><dir name="locale"><dir name="en_US"><file name="Mage_PiwikAnalytics.csv" hash="81f396756f8f7f7249c465da55b58052"/></dir></dir></dir></dir></target></contents>
47+
<date>2014-12-02</date>
48+
<time>00:40:57</time>
49+
<contents><target name="mage"><dir name="."><dir name="app"><dir name="code"><dir name="community"><dir name="PiwikMage"><dir name="PiwikAnalytics"><dir><dir name="Block"><file name="Piwik.php" hash="4b2f693ca11afead15b4325899b492f6"/></dir><dir name="Helper"><file name="Data.php" hash="4a7b01ffa40694a72cf41629e5d73a9c"/></dir><dir name="Model"><file name="Observer.php" hash="75cd8c7cfe2db518885e1ddc5ba8a7c0"/></dir><dir name="controllers"><file name="IndexController.php" hash="c1ec8d1e999e79891c3cdfe3dbacf8a7"/></dir><dir name="etc"><file name="adminhtml.xml" hash="01c60c66677b73280d496db67b29cd88"/><file name="config.xml" hash="975b4ccefa07d612faa42b41fe43341a"/><file name="system.xml" hash="01cf335469570e7b08e69964d88e3b7d"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="piwikanalytics"><file name="piwik.phtml" hash="61e1b1660d06392fa319c6480eef7acc"/></dir></dir><dir name="layout"><file name="piwikanalytics.xml" hash="0ecc6b445f0457ccec40259fee63c348"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="PiwikMage_PiwikAnalytics.xml" hash="0712342b3649d899fc2f773c4cd10875"/></dir></dir><dir name="locale"><dir name="en_US"><file name="PiwikMage_PiwikAnalytics.csv" hash="1d58be97f37a234562d96d603bac7d21"/></dir><dir name="de_DE"><file name="PiwikMage_PiwikAnalytics.csv" hash="e6df4880421a60c4aa42d3ca95de0618"/></dir></dir></dir></dir></target></contents>
5050
<compatible/>
5151
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
5252
</package>

0 commit comments

Comments
 (0)