Open raycohen opened 7 years ago
There's nothing built into the SDK at the moment for this functionality. The feature seems totally reasonable and within the scope of the lib; we'd be happy to look at a Pull Request!
Me and @rcohen were going through the lib and we were thinking about something like this:
Based off MixpanelPersistence.prototype.register
MixpanelPersistence.prototype.register_page_lifespan = function(props) {
if (_.isObject(props)) {
// no expiration checking since we aren't persisting
// this.expire_days = (typeof(days) === 'undefined') ? this.default_expiry : days;
_.extend(this['props'], props);
// don't persist since we want it to be cleared on page navigation/refresh
// this.save();
return true;
}
return false;
};
I think this would add it to all subsequent calls and would be cleared on navigation, but wanted some feedback before I get that PR in
I want to add some common properties to all uses of mixpanel.track that occur on a single page.
The API provided by mixpanel.register is close to this but additionally sets a cookie so these properties are retained across all pages.
Is there any way to have this behavior but without the impact lasting beyond the life of that one page?