Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Add support for track type "screen" #398

Open
abdelbolanos opened this issue Mar 26, 2015 · 1 comment
Open

Add support for track type "screen" #398

abdelbolanos opened this issue Mar 26, 2015 · 1 comment

Comments

@abdelbolanos
Copy link

Hi,
For add support to track type "screen" this has to be added

plugin/src/blackberry10/index.js

--just below case "item"

case "screen":
optionString += "&t=screenview";
optionString += getParameter(args, "an", "appName");
optionString += getParameter(args, "av", "appVersion");
optionString += getParameter(args, "aid", "appId");
optionString += getParameter(args, "aiid", "appInstallerId");
optionString += getParameter(args, "cd", "screenName");
break;

and in plugin/www/client.js

--just below _self.trackTransaction = function

//Screen hit tracking,
//
_self.trackScreen = function(screenName, appName, appVersion, appId, appInstallerId){

    var result = 'Missing screenName parameter';

    if (screenName)
    {
        appName = appName || "";
        appVersion = appVersion || "";
        appId = appId || "";
        appInstallerId = appInstallerId || "";

        var success = function (data, response) {
                //result = data;
                result = "";
            },
            fail = function (data, response) {
                console.log("Error: " + data);
                result = "Error: " + data;
            };
        exec(success, fail, _ID, "trackAll", {
            "trackType": "screen",
            "screenName": screenName, 
            "appName": appName,
            "appVersion": appVersion,
            "appId": appId,
            "appInstallerId": appInstallerId 
        });
    }       
};

This will allow to track screens in GA
Example:

var screenName = encodeURIComponent('My Screen 1');
var appName = blackberry.app.name;
var appId = blackberry.app.id;
var appVersion = blackberry.app.version;
sError = community.googleanalyticsplugin.trackScreen(screenName,appName, appVersion, appId);

@timwindsor
Copy link
Collaborator

We've been working on integrating the plugin into the main PhoneGap one, so this version is out of date. Does your code still apply to the version we have here? -- https://github.com/blackberry/GAPlugin

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants