diff options
Diffstat (limited to 'StoneIsland/platforms/ios/www')
| -rw-r--r-- | StoneIsland/platforms/ios/www/cordova_plugins.js | 12 | ||||
| -rw-r--r-- | StoneIsland/platforms/ios/www/plugins/cordova-plugin-google-analytics/www/analytics.js | 130 |
2 files changed, 141 insertions, 1 deletions
diff --git a/StoneIsland/platforms/ios/www/cordova_plugins.js b/StoneIsland/platforms/ios/www/cordova_plugins.js index 4c67a219..878291ea 100644 --- a/StoneIsland/platforms/ios/www/cordova_plugins.js +++ b/StoneIsland/platforms/ios/www/cordova_plugins.js @@ -130,6 +130,15 @@ module.exports = [ "clobbers": [ "PushNotification" ] + }, + { + "id": "cordova-plugin-google-analytics.UniversalAnalytics", + "file": "plugins/cordova-plugin-google-analytics/www/analytics.js", + "pluginId": "cordova-plugin-google-analytics", + "clobbers": [ + "analytics", + "ga" + ] } ]; module.exports.metadata = @@ -147,7 +156,8 @@ module.exports.metadata = "cordova-plugin-whitelist": "1.3.0", "cordova-plugin-x-socialsharing": "5.1.3", "ionic-plugin-keyboard": "2.2.1", - "phonegap-plugin-push": "1.9.2" + "phonegap-plugin-push": "1.9.2", + "cordova-plugin-google-analytics": "1.8.3" }; // BOTTOM OF METADATA });
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-google-analytics/www/analytics.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-google-analytics/www/analytics.js new file mode 100644 index 00000000..b46b19ea --- /dev/null +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-google-analytics/www/analytics.js @@ -0,0 +1,130 @@ +cordova.define("cordova-plugin-google-analytics.UniversalAnalytics", function(require, exports, module) { +function UniversalAnalyticsPlugin() {} + +UniversalAnalyticsPlugin.prototype.startTrackerWithId = function(id, dispatchPeriod, success, error) { + if (typeof dispatchPeriod === 'undefined' || dispatchPeriod === null) { + dispatchPeriod = 30; + } else if (typeof dispatchPeriod === 'function' && typeof error === 'undefined') { + // Called without dispatchPeriod but with a callback. + // Looks like the original API was used so shift parameters over to remain compatible. + error = success; + success = dispatchPeriod; + dispatchPeriod = 30; + } + cordova.exec(success, error, 'UniversalAnalytics', 'startTrackerWithId', [id, dispatchPeriod]); +}; + +UniversalAnalyticsPlugin.prototype.setAllowIDFACollection = function(enable, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setAllowIDFACollection', [enable]); +}; + +UniversalAnalyticsPlugin.prototype.setUserId = function(id, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setUserId', [id]); +}; + +UniversalAnalyticsPlugin.prototype.setAnonymizeIp = function(anonymize, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setAnonymizeIp', [anonymize]); +}; + +UniversalAnalyticsPlugin.prototype.setOptOut = function(optout, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setOptOut', [optout]); +}; + +UniversalAnalyticsPlugin.prototype.setAppVersion = function(version, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setAppVersion', [version]); +}; + +UniversalAnalyticsPlugin.prototype.getVar = function(variable, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'getVar', [variable]); +}; + +UniversalAnalyticsPlugin.prototype.setVar = function(variable, value, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setVar', [variable, value]); +}; + +UniversalAnalyticsPlugin.prototype.dispatch = function(success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'dispatch', []); +}; + +/* enables verbose logging */ +UniversalAnalyticsPlugin.prototype.debugMode = function(success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'debugMode', []); +}; + +UniversalAnalyticsPlugin.prototype.trackMetric = function(key, value, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'trackMetric', [key, value]); +}; + +UniversalAnalyticsPlugin.prototype.trackView = function(screen, campaignUrl, newSession, success, error) { + if (typeof campaignUrl === 'undefined' || campaignUrl === null) { + campaignUrl = ''; + } + + if (typeof newSession === 'undefined' || newSession === null) { + newSession = false; + } + + cordova.exec(success, error, 'UniversalAnalytics', 'trackView', [screen, campaignUrl, newSession]); +}; + +UniversalAnalyticsPlugin.prototype.addCustomDimension = function(key, value, success, error) { + if (typeof key !== "number") { + throw Error("key must be a valid integer not '" + typeof key + "'"); + } + cordova.exec(success, error, 'UniversalAnalytics', 'addCustomDimension', [key, value]); +}; + +UniversalAnalyticsPlugin.prototype.trackEvent = function(category, action, label, value, newSession, success, error) { + if (typeof label === 'undefined' || label === null) { + label = ''; + } + if (typeof value === 'undefined' || value === null) { + value = 0; + } + + if (typeof newSession === 'undefined' || newSession === null) { + newSession = false; + } + + cordova.exec(success, error, 'UniversalAnalytics', 'trackEvent', [category, action, label, value, newSession]); +}; + +/** + * https://developers.google.com/analytics/devguides/collection/android/v3/exceptions + */ +UniversalAnalyticsPlugin.prototype.trackException = function(description, fatal, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'trackException', [description, fatal]); +}; + +UniversalAnalyticsPlugin.prototype.trackTiming = function(category, intervalInMilliseconds, name, label, success, error) { + if (typeof intervalInMilliseconds === 'undefined' || intervalInMilliseconds === null) { + intervalInMilliseconds = 0; + } + if (typeof name === 'undefined' || name === null) { + name = ''; + } + if (typeof label === 'undefined' || label === null) { + label = ''; + } + + cordova.exec(success, error, 'UniversalAnalytics', 'trackTiming', [category, intervalInMilliseconds, name, label]); +}; + +/* Google Analytics e-Commerce Tracking */ +/* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce */ +UniversalAnalyticsPlugin.prototype.addTransaction = function(transactionId, affiliation, revenue, tax, shipping, currencyCode, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'addTransaction', [transactionId, affiliation, revenue, tax, shipping, currencyCode]); +}; + +UniversalAnalyticsPlugin.prototype.addTransactionItem = function(transactionId, name ,sku, category, price, quantity, currencyCode, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'addTransactionItem', [transactionId, name ,sku, category, price, quantity, currencyCode]); +}; + +/* automatic uncaught exception tracking */ +UniversalAnalyticsPlugin.prototype.enableUncaughtExceptionReporting = function (enable, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'enableUncaughtExceptionReporting', [enable]); +}; + +module.exports = new UniversalAnalyticsPlugin(); + +}); |
