Tracking members visit of pages

Hi,

In my wixsite, members click a button to visit a page.

Is there a way to track that a member has clicked a button? For example, the color of the button changes on click --this way, the next time the member wants to click the button, the member would know that the button was once clicked.

The tracking needs to be kept so that the color change effect of the button at next login remains in effect.

This should be possible, Ismail. You’ll have to change the button’s styling elements in code and set a local cookie in the button’s onClick function. Use that cookie to determine what the button’s style should be on page or site load.

I really wish I knew how to do what you have suggested

@museade Try something like this:

import {local} from 'wix-storage';

$w.onReady(function() {
    if (!local.getItem('buttonClicked')) {
        $w('#button').style = "borderColor:red";
    }
} );

export function button_click(event) {
    if ($w('#button').style === "borderColor:blue" & !local.getItem('buttonClicked')) {
        local.setItem('buttonClicked', 'yes');
        $w('#button').style = "borderColor:red";
    } else {
        local.removeItem('buttonClicked');
        $w('#button').style = "borderColor:blue";
    }
}

Can I change for example, color of a button or text of a label on “Page A” by clicking a button on “Page B” --a little different from my initial question (however this is what i actually intended).

Sure, for that just base it on the cookie itself. I.E.:

instead of

if ($w('#button').style === "borderColor:blue" && !local.getItem('buttonClicked'))

use

if (!local.getItem('buttonClicked'))