samzilverberg/cordova-mixpanel-plugin

Mixpanel tracing same event in diffferent places

Closed this issue · 4 comments

We have one event that we need to track in different places for e.g find the Syncing start time and end time.

I placed the mix panel sync event in the sync start function and also in the success call back to capture the sync end time. But this get tracked as two events on the Mix panel. But we need that two properties (sync start time and end time) should capture in the same event call.

Could you please advice how do we do that?

code sample would be more clear, can you give an example of what youre doing?

in general:

  • if you call track twice you will have 2 events.
  • theres a window.mixpanel.timeEvent fn you can use to time events
    • i forgot to document it in readme
    • you can peek in the code to see what it accepts and read about it in the mixpanel sdk site

Code sample:
I need to track the video start time and end time. I am using the streamingMediaPlayer cordova plugin for the video.

On the Video open link I have to capture the video start time
$scope.openLink = function onOpenLink(url) {
/* MixPanel Tracking Video Click - here I need to capture the start time*/

                    $streamingMediaPlayer.playVideo(UserService.getCurrent().id, url);
        };

On the PlayVideo success callback I need to capture the time Video ends".

playVideo: function(id, url, options) {
options = options || {};
var q = $q.defer();
var defaultOptions = {
shouldAutoClose: true,
successCallback: function() {
q.resolve();
console.log("Video was closed without error.");
/* MixPanel Tracking Video Click - here I need to capture the End time*/
},
errorCallback: function(errMsg) {
q.reject(errMsg);
}
};

        if (!window.plugins || !window.plugins.streamingMedia) {
            console.log('No plugin detected, fallback to InAppBrowser.');
            window.open(url, '_blank', 'location=yes');
            q.resolve();
        } else {
            window.plugins.streamingMedia.playVideo(url, _.extend(defaultOptions, options));
        }

        return q.promise;
    }

Please advice how can I achieve this.

please format your message and remove all code thats not related to the problem.
i cant understand anything of it the way it is now

closing: no useful input from issue opener