Different Events in Google Analytics Tracking

Hi,

I added the script file to track events in Google Analytics and it works fine.

I am using the oneall api in two places (one in popups and one in registration page). I would like to track it as two different events to see which one performs better. Is there a way I can do that?

Kind Regards,
Fariz

Best Answer

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    Answer ✓
    Just create a file a.js and a file b.js on your server.
    Add the code that I have posted above to both files.

    Then embed a.js using a script tag to the first page.
    Then embed b.js using a script tag to the second page.

    Thene change the code in b.js so that you have different logs.

Answers

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    edited July 2017
    Hi Fariz,

    the embedded file looks like this:

    /* OneAll | Google Analytics Integration */ var _gaq = _gaq || [], _oneall = _oneall || [], _oneall_gat = { subdomain: "oneall", track: function() { var a, b; a = Array.prototype.slice.call(arguments); "object" == typeof console && console.log(a); b = (a.shift(), "_trackEvent"); a.shift(); _gaq.push([b].concat(a)) }, e: {} }; _oneall_gat.e.on_widget_loaded = function() { _oneall_gat.track("event", "on_widget_loaded", "[" + _oneall_gat.subdomain + "] Widget Loaded") }; _oneall_gat.e.on_open_popup_ui = function(a) { _oneall_gat.track("event", "on_open_popup_ui", "[" + _oneall_gat.subdomain + "] Modal Dialog Opened", a.service) }; _oneall_gat.e.on_close_popup_ui = function(a) { _oneall_gat.track("event", "on_close_popup_ui", "[" + _oneall_gat.subdomain + "] Modal Dialog Closed", a.service) }; _oneall_gat.e.on_login_begin = function(a) { _oneall_gat.track("event", "on_login_begin", "[" + _oneall_gat.subdomain + "] Login: Begin", a.service, a.provider.name) }; _oneall_gat.e.on_login_end_success = function(a) { _oneall_gat.track("event", "on_login_end_success", "[" + _oneall_gat.subdomain + "] Login: Sucess", a.service, a.provider.name) }; _oneall_gat.e.on_login_end_error = function(a) { _oneall_gat.track("event", "on_login_end_error", "[" + _oneall_gat.subdomain + "] Login: Error", a.service, a.provider.name) }; _oneall_gat.e.on_login_end_cancelled = function(a) { _oneall_gat.track("event", "on_login_end_cancelled", "[" + _oneall_gat.subdomain + "] Login: Cancelled", a.service, a.provider.name) }; (function() { _oneall.push( ["*", "set_event", "on_widget_loaded", _oneall_gat.e.on_widget_loaded()], ["*", "set_event", "on_open_popup_ui", _oneall_gat.e.on_open_popup_ui], ["*", "set_event", "on_close_popup_ui", _oneall_gat.e.on_close_popup_ui], ["*", "set_event", "on_login_begin", _oneall_gat.e.on_login_begin], ["*", "set_event", "on_login_end_success", _oneall_gat.e.on_login_end_success], ["*", "set_event", "on_login_end_error", _oneall_gat.e.on_login_end_error], ["*", "set_event", "on_login_end_cancelled", _oneall_gat.e.on_login_end_cancelled]) })();

    What you could do is create two .JS files with that code on your server.
    On one page you embed the first and on the other page the second file.
    Then you can edit the logged messages to differenciate the logs.

    You then no longer need to embed our Google analytics tracking file.
  • Two .js files of what code? Can you explain bit more clearly?

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.