Accessing login page via jQuery


I have created page (let's say scene_1 called "Portal") and setup it as login protected within Knack environment. The result is that Knack created new parted page to my scene_1 and called it "Portal Login" with key: scene_2.

Now I want to put some Java code on this scene_2 page. Knack environment says it has one view called let's say view_5. I can put some code on this view_5 like:

$(document).on('knack-view-render.view_5', function(event, view, data) { 
  mixpanel.track("Login", {"Page name":"Portal Login"});

Whne I check logs I see that this view_5 is on scene_2 (login page). But when I want to create something like:

$(document).on('knack-scene-render.any', function(event, page) { 

var firstview = page.views[0].key; //normally find the key for first view on page

if (firstview = “view_5”) {


else { // another action


it never finds my view_5. I found out from logs that in the page.view[] table on login page are views from scene_1 not from scene_2.

So I cannot recognize the login form by using callback on rendering pages.

Any idea how make a workaround?

thanks in advance.



I have found easy solution by using Knack.getUserAttributes().

var user = Knack.getUserAttributes();
if ( == null){
  // this means that User is on login page, so I logout him from tracking codes
else {
  // this mean that User is already logged in, so he is not on login page
  // as he might just log in I am calling identify tracing code

'tracking' is an example, but most tracking platforms have similar functions.