How can I action the cookies / privacy policy option in my app?

Hi!
I need some help with the cookies/privacy policy screen on my app, currently, when users click on the accept button they just move on to the next screen.
But when they click decline nothing happens, how can I allow users to decline the cookies and proceed to the app without having any cookies saved against their user?

Hi Carina,

You will need to add some JS to the screen JS that disables the tracking for the current user.

Example JS:

$(document).on('click', ".btn.btn-primary.pull-right.focus-outline", function() {
	//Button was clicked
  console.log("A button was clicked!");
  if ($(this).text() === 'Decline'){
    //Decline button was clicked
    Fliplet.Analytics.disableTracking().then(function(){
      //Navigate to a screen after analytics is disabled
      Fliplet.Navigate.screen('Company news');
    })
  }
});

This assumed you have a submit button from the form component. If you add a button component itself the code snippet might need to be slightly changed.

Hope this helps,
Deb

1 Like

Thanks Deb! My screen has a decline button rather than a form field button, what would be the code snippet for that?

Hi Carina,

Is it a primary button or a secondary button?

It’s a primary button

You can try this:

$(document).on('click', ".btn.btn-primary.focus-outline", function() {
	//Button was clicked
  console.log("A button was clicked!");
  if ($(this).text() === 'Decline'){
    //Decline button was clicked
    Fliplet.Analytics.disableTracking().then(function(){
      //Navigate to a screen after analytics is disabled
      Fliplet.Navigate.screen('Company news');
    })
  }
});


1 Like

One more question, does the user need to be logged in for this to work?

They don’t have to be. They can either be logged in or not logged in. The system will figure it out.