Assume that any money that is contingent is not ever going to be paid. Get enough upfront that you wouldn't feel ripped off if you never got another dime. Shit happens and they'll be in more control than you.
To ensure the highest possible chance of getting the rest of the money have it put in escrow. Structure it so that the escrow service pays out the money according to a very simple metric. Using Google Analytics is probably a reasonable method, as it's a third-party and not open to direct manipulation.
If they're not willing to put the money in escrow that's a huge red flag that they're expecting not to have to pay it out. Accept no excuses on this point, increase the upfront payment accordingly, or don't accept the deal.
To ensure the highest possible chance of getting the rest of the money have it put in escrow. Structure it so that the escrow service pays out the money according to a very simple metric. Using Google Analytics is probably a reasonable method, as it's a third-party and not open to direct manipulation.
If they're not willing to put the money in escrow that's a huge red flag that they're expecting not to have to pay it out. Accept no excuses on this point, increase the upfront payment accordingly, or don't accept the deal.