Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Multipage Mashup - keep selections between html pages?

Hi!

We have received a nice mashup that contains of multiple .html-Pages. See here: http://demo.heldendaten.net:8080/extensions/Vertriebsdemo_Sense_Mashup/Produkte.html

Unfortunately, if a user does selections on one .html-Page (for example Produkt.html), these selections are lost when the user changes to another html page.

From what I see in the .js code, the Mashup always calls the following  code on every new page. See below.

--> to me it seems that calling openApp on every page, opens a new connection to the document --> old selections are lost.

--> I have read through the mashup API, but haven't really found anything to keep the app-session alive between multiple pages. I have played wit the "identity" property of the app config, but no success (running Qlik Sense 2.0.3)

--> has anyone a short example how I can fix the existing code?

var config = {
     host: window.location.hostname,
     prefix: "/",
     port: window.location.port,
     isSecure: window.location.protocol === "https:"
  //,
  //identity: "12349876"
};
require.config( {
     baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port: "") + config.prefix + "resources"
} );

require( ["js/qlik"], function ( qlik ) {
     qlik.setOnError( function ( error ) {
          alert( error.message );
     } );

     //callbacks -- inserted here --
  
     //open apps -- inserted here --
  
  
      app = qlik.openApp("871f98c2-38cd-46b1-9676-6dd3e87f06be", config);

     
  
     //get objects -- inserted here --
  
       $(".qvobject").each(function() {
          var qvid = $(this).data("qvid");
          app.getObject(this, qvid);
     });

29 Replies
Alexander_Thor
Employee
Employee

Both QlikView and Qlik Sense has session states where your selections will be kept between sessions.

However for this mashup you are allowing anonymous access, so when someone hits the page they will be considered anonymous and given a session.

When they navigate away from it the session cookie is most likely cleared out and then a new session is assigned to them upon opening a new page. New session cookie and anonymous user so we can't retrive your previous selection state as we don't know who you are.

If you would authenticate your users the selections should carry over between pages assuming they are using the same app.

Anonymous
Not applicable
Author

Thx for analysing the issue.

it's true, users are anonymous (as this is a public demo site) using login tokens.

I would expect this to be a wanted deployment scenario for a mashup. Everytime someone integrates Qlik Sense into a public (multipage) website, one will have the same issue.

So any idea how to solve this, without authenticating users? Not quite sure what the "identity" property is good for in the config-object. This sounds a little bit like I can force a user to reuse a session. But i don't get it to work.

Thx,

Roland

Aiham_Azmeh
Employee
Employee

Hi,

Yes, you should be able to use identity (http://help.qlik.com/sense/2.0/en-us/developer/#../Subsystems/APIs/Content/MashupAPI/Methods/openApp...) for reusing sessions between pages.

...But, I think that the issue will be that all you visitors, will share the same session, so selections made by user A will affect the selections of user B.

There should be some methods (server side) to generate a unique identifier per user, that can later be set as identity value in your config.

ErikWetterberg

Hi,

this is a tricky one... I can see two different ways to solve this:

- make the mashup single page, and instead of switching to another page replace the content in side the page

- create some temporary identification for users (based in their ip address perhaps??) so that Qlik would know that this is the same user when he switches to page two

I assume that if you are using authenticated users this works as it should.

Hope this helps

Erik

Please mark the appropriate replies as correct or helpful so our team and other members know that your question has been answered to your satisfaction.

Anonymous
Not applicable
Author

ok, I will try to use "identity" with some "unique identifier". But as I said before I already tried to hardcode a "identity", but without any success.

I will give feedback when I get it to work..

ErikWetterberg

I don't think that adding identity to your openApp call will help, identity is used to support several sessions for the same user by giving them separate identities, your problem is that users are anonymous.

To get this to work you probably would need to connect your anonymous users to Qlik Sense users and use something like ip address to make sure they are connected to the same Qlik Sense user when they switch to another page.

Hope this helps

Erik

Please mark the appropriate replies as correct or helpful so our team and other members know that your question has been answered to your satisfaction.

Anonymous
Not applicable
Author

hi!

I now did some further tests, with a hardcoded "identity". Unfortunately I had no success.

I used a hardcoded 'identity: "111"'. See screenshot below.

_2015-09-10_16-03-51.png'

But still selections are not applied when I click onto another page. Interestingly every "page"-change opens a new Websocket-Frame that shows the same "X-Qlik-Session" request-cookie with the same GUID. So it seems that some state management is done, even selections are lost...

Any further ideas?

Qlik  Vertriebsdemo - Google Chrome_2015-09-10_16-02-15.png

Alexander_Thor
Employee
Employee

If you inspect the socket frames you should find that the first frame will contain a response back giving you authentication information, most likely you are assigned a new user id.

This page from the documentation discusses Engine session which might help you wrap your head around it https://help.qlik.com/sense/2.0/en-us/developer/Subsystems/Platform/Content/Concepts/sessions.htm

Your best bet to solve this with anonymous users is to create a single page application like Erik stated before.

jim_chan
Specialist
Specialist

Hi Guys,

I created a mashup with multiple html pages with No anonymous user mode.

But i having problem to preserve the current selection when i navigate between the html pages.

Example: user select year 2015 in html A and 2015 selection is lost when i navigate to Html B.

Kindly advice if there is anything wrong.

ScreenHunter_162 Apr. 08 23.12.jpg

Following is the threat i logged earlier.

Keep current selection between mashup page