[MOD] Zopim Module (analytics-ish)
Posted: Thu Feb 17, 2011 11:07 pm
This module borrows much of the knowledge I gained from hacking the Woopra analytics module together and the modifications required to existing files are exactly the same (minus the Facebook stuff, which is unused here).
As with the Woopra code, it's freely available (not for re-sale) BUT I would appreciate anyone using it putting their hands in their pocket and donating £10 ($15) or more to a charity by way of thank-you... Good deeds should be rewarded or at least paid forward... but I'll let you conscience and the knowledge that Karma generally wins out guide you on that one
Open: /templates/__master/Panels/HTMLHead.html
Find & CUT (Delete)
Find:
After, PASTE (Add):
Open: /includes/display/HTMLHead.php
Find:
BEFORE, Add:
Copy the following files (See attached) to the relevant folders and overwrite as appropriate (Make BACKUPS of original files FIRST).
Add:
Functionality:
ChangeLog:
As with the Woopra code, it's freely available (not for re-sale) BUT I would appreciate anyone using it putting their hands in their pocket and donating £10 ($15) or more to a charity by way of thank-you... Good deeds should be rewarded or at least paid forward... but I'll let you conscience and the knowledge that Karma generally wins out guide you on that one

Open: /templates/__master/Panels/HTMLHead.html
Find & CUT (Delete)
Code: Select all
<!-- Include visitor tracking code (if any) -->
%%GLOBAL_TrackingCode%%
Code: Select all
<script type="text/javascript" src="%%GLOBAL_ShopPath%%/javascript/jquery.js?%%GLOBAL_JSCacheToken%%"></script>
Code: Select all
<!-- Include visitor tracking code (if any) -->
%%GLOBAL_TrackingCode%%
Open: /includes/display/HTMLHead.php
Find:
Code: Select all
// Include the tracking code for each analytics module
$GLOBALS['TrackingCode'] .= GetTrackingCodeForAllPackages();
Code: Select all
// MOD Woopra/Zopim Analytics
if(CustomerIsSignedIn()) {
// If they're a customer, set their name so it's available in the templates
$c = GetClass('ISC_CUSTOMER');
$customerData = $c->GetCustomerDataByToken();
$GLOBALS['CurrentCustomerFirstName'] = isc_html_escape($customerData['custconfirstname']);
$GLOBALS['CurrentCustomerLastName'] = isc_html_escape($customerData['custconlastname']);
$GLOBALS['CurrentCustomerEmail'] = isc_html_escape($customerData['custconemail']);
}
// MOD END Woopra/Zopim Analytics
Add:
- /modules/analytics/zopim (and contents)
Functionality:
- Provides a specific Zopim code module (rather than having to hard code the widget into your files or use the GA one)
- Auto tags Zopim visitors with their name and email when they are logged in
ChangeLog:
- 1.0.0
- Initial release
- 1.0.1
- Added sanity check for $zopim object before it tries to set the name & email values
- This stops the JS error when a chat session hasn't been started