[Skip to main content](#vessel-content)

#   Google Universal Analytics Broken

##

- **[Dorgo](/forum/user/8838-dorgo "View Dorgo's Profile")**
- [![Dorgo's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8838-dorgo "View Dorgo's Profile") Topic Author
- [ Offline](/forum/user/8838-dorgo)

Less More

- Posts: 51
- Thank you received: 1
-
-

12 years 3 weeks ago -  12 years 3 weeks ago [\#178218](#178218) by [Dorgo](/forum/user/8838-dorgo "View Dorgo's Profile")  *[Google Universal Analytics Broken](/forum/25-install-update/872791-google-universal-analytics-broken#178218 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 2.5.27 -- PHP version -- : 5.3.29 -- Browser(s) name and version -- : N/A  The parameter you are storing in the database is universal&#95;analytics  Instead, you are checking for use&#95;universal in the plugin  Was this even remotely tested or reviewed?")* was created by *[Dorgo](/forum/user/8838-dorgo "View Dorgo's Profile")*

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 2.5.27
-- PHP version -- : 5.3.29
-- Browser(s) name and version -- : N/A

The parameter you are storing in the database is **universal\_analytics**
Code:

'HikaShop Google Analytics plugin','plugin','hikashopanalytics','system',0,1,1,0,'','{\"universal_analytics\":\"1\"

Code:

&lt;param name="universal_analytics" type="radio" default="0" label="Use universal analytics" description="Use or not the new API of google analytics (ga.js or universal.js)"&gt; &lt;option value="0"&gt;No&lt;/option&gt; &lt;option value="1"&gt;Yes&lt;/option&gt; &lt;/param&gt;

Instead, you are checking for **use\_universal** in the plugin
Code:

if($this-&gt;params-&gt;get('use_universal', 0)) {

Was this even remotely tested or reviewed?

Last edit: 12 years 3 weeks ago by [Dorgo](/forum/user/8838-dorgo "View Dorgo's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3Mjc5MS1nb29nbGUtdW5pdmVyc2FsLWFuYWx5dGljcy1icm9rZW4/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

12 years 3 weeks ago -  12 years 3 weeks ago [\#178262](#178262) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Google Universal Analytics Broken](/forum/25-install-update/872791-google-universal-analytics-broken#178262 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 2.5.27 -- PHP version -- : 5.3.29 -- Browser(s) name and version -- : N/A  The parameter you are storing in the database is universal&#95;analytics  Instead, you are checking for use&#95;universal in the plugin  Was this even remotely tested or reviewed?")*

Hi,

Well, it has not.
I asked the HikaShop team to test my development but I guess that they include them partially and without test it.
Please replace "universal_analytics" by "use_universal" in the XML.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Last edit: 12 years 3 weeks ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3Mjc5MS1nb29nbGUtdW5pdmVyc2FsLWFuYWx5dGljcy1icm9rZW4/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Dorgo](/forum/user/8838-dorgo "View Dorgo's Profile")**
- [![Dorgo's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8838-dorgo "View Dorgo's Profile") Topic Author
- [ Offline](/forum/user/8838-dorgo)

Less More

- Posts: 51
- Thank you received: 1
-
-

12 years 3 weeks ago -  12 years 3 weeks ago [\#178439](#178439) by [Dorgo](/forum/user/8838-dorgo "View Dorgo's Profile")  Replied by *[Dorgo](/forum/user/8838-dorgo "View Dorgo's Profile")* on topic *[Google Universal Analytics Broken](/forum/25-install-update/872791-google-universal-analytics-broken#178439 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 2.5.27 -- PHP version -- : 5.3.29 -- Browser(s) name and version -- : N/A  The parameter you are storing in the database is universal&#95;analytics  Instead, you are checking for use&#95;universal in the plugin  Was this even remotely tested or reviewed?")*

Thanks Jerome, did you write the plugin for hikashop?

The regex that strips out the existing snippet needs updating:

**plugins/system/hikashopanalytics/hikashopanalytics.php**:84 Code:

preg_replace("#&lt;script type=\"text/javascript\"&gt;(?:(?!&lt;script).)*'https://ssl' : 'http://www'\) \+ '\.google-analytics\.com.*&lt;/script&gt;#siU", '', $body);

change to Code:

$body = preg_replace("#&lt;script type=\"text/javascript\"&gt;(?:(?!&lt;script).)*('https://ssl' : 'http://www'\) \+ '\.&#124;window,document,'script','//www\.)google-analytics\.com.*&lt;/script&gt;#siU", '', $body);

also, it would be nice to be able to handle extra features without hacking the plugin eg, Code:

ga('require', 'displayfeatures'); ga('require', 'linkid', 'linkid.js');

Last edit: 12 years 3 weeks ago by [Dorgo](/forum/user/8838-dorgo "View Dorgo's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3Mjc5MS1nb29nbGUtdW5pdmVyc2FsLWFuYWx5dGljcy1icm9rZW4/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

12 years 3 weeks ago [\#178495](#178495) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Google Universal Analytics Broken](/forum/25-install-update/872791-google-universal-analytics-broken#178495 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 2.5.27 -- PHP version -- : 5.3.29 -- Browser(s) name and version -- : N/A  The parameter you are storing in the database is universal&#95;analytics  Instead, you are checking for use&#95;universal in the plugin  Was this even remotely tested or reviewed?")*

Hi,

I just update existing plugin in order to add the support of "universal".
It was some kind of "POC", something I made at 3am and because I do not have any GA account (or Universal) I couldn't test it.

Thanks for the modification about the regex ; I updated the plugin.
I also added two new options for the modules (linkid and displayfeatures).
linkid will have a support for GA and UA ; displayfeatures is only available for UA.

UA part: Code:

$extra_required = ''; if($this-&gt;params-&gt;get('module_displayfeatures', 0)) $extra_required .= "\r\n" . 'ga("require", "displayfeatures");'; if($this-&gt;params-&gt;get('module_linkid', 0)) $extra_required .= "\r\n" . 'ga("require", "linkid", "linkid.js");';

Code:

ga("send", "pageview");'.$extra_required.'

GA part: Code:

$extra_required = ''; if($this-&gt;params-&gt;get('module_linkid', 0)) $extra_required .= "\r\n" . 'var pluginUrl = "//www.google-analytics.com/plugins/ga/inpage_linkid.js"; _gaq.push(["_require", "inpage_linkid", pluginUrl]);';

Code:

var _gaq = _gaq &#124;&#124; [];'.$extra_required.'

(plus the options in the XML file)

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3Mjc5MS1nb29nbGUtdW5pdmVyc2FsLWFuYWx5dGljcy1icm9rZW4/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.057 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
