Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as Mixpanel from 'react-native-mixpanel';
Mixpanel.sharedInstanceWithToken('1234567890');
Mixpanel.track('Event name');
Mixpanel.trackWithProperties('Click Button', { button_type: 'yellow button', button_text: 'magic button' });
Mixpanel.createAlias('123456');
Mixpanel.identify('123456');
Mixpanel.set({ $email: 'elvis@email.com' });
Mixpanel.setOnce({ $email: 'elvis@email.com', Created: new Date().toISOString() });
Mixpanel.timeEvent('Image Upload');
Mixpanel.track('Image Upload');
Mixpanel.registerSuperProperties({ 'Account type': 'Free', 'User Type': 'Vendor' });
Mixpanel.registerSuperPropertiesOnce({ Gender: 'Female' });
Mixpanel.trackCharge(399);
Mixpanel.trackChargeWithProperties(399, { product: 'ACME Wearable tech' });
Mixpanel.increment("Login Count", 1);
Mixpanel.setPushRegistrationId('1234567890abc');
Mixpanel.initPushHandling('123456666');
Mixpanel.clearPushRegistrationId();
Mixpanel.addPushDeviceToken('1234567890abc');
Mixpanel.reset();
export function track(eventName: string, params: ?Params) {
if (!trackingEnabled) {
return;
}
console.log('Tracking', eventName, params);
if (params != null) {
const firebaseSafeParams = {};
for (const key of Object.keys(params)) {
firebaseSafeParams[firebaseSafe(key)] = params[key];
}
AppEventsLogger.logEvent(eventName, 1, params);
Mixpanel.trackWithProperties(eventName, params);
firebase.analytics().logEvent(firebaseSafe(eventName), firebaseSafeParams);
} else {
AppEventsLogger.logEvent(eventName, 1);
Mixpanel.track(eventName);
firebase.analytics().logEvent(firebaseSafe(eventName));
}
}
var url = 'https://api.producthunt.com/v1/categories/'+this.state.category+'/posts?day=' + day;
} else {
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
var day = yyyy+'-'+mm+'-'+dd;
var pass_day = yyyy+'/'+mm+'/'+dd;
this.setState({ date_text: 'TODAY', date: pass_day });
var url = 'https://api.producthunt.com/v1/categories/'+this.state.category+'/posts?days_ago=0';
}
Mixpanel.trackWithProperties('View Posts Page', {
category: this.state.category
});
var requestObj = {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + this.state.access_token,
'Host': 'api.producthunt.com'
}
};
fetch(url, requestObj)
.then((response) => response.json())
.then((responseData) => {
console.log(responseData.posts);
this.setState({ posts: responseData.posts });
share: function () {
Mixpanel.trackWithProperties('Share Post', {
share_text: this.state.post.name,
share_URL: this.state.post.redirect_url
});
Share.open({
share_text: this.state.post.name,
share_URL: this.state.post.redirect_url,
title: "Sharing is Caring"
}, function (e) {
console.log(e);
});
},
export function track(eventName: string, params: ?Params) {
if (!trackingEnabled) {
return;
}
if (params != null) {
const firebaseSafeParams = {};
for (let key of Object.keys(params)) {
firebaseSafeParams[firebaseSafe(key)] = params[key];
}
AppEventsLogger.logEvent(eventName, 1, params);
Mixpanel.trackWithProperties(eventName, params);
Analytics.logEvent(firebaseSafe(eventName), firebaseSafeParams);
} else {
AppEventsLogger.logEvent(eventName, 1);
Mixpanel.track(eventName);
Analytics.logEvent(firebaseSafe(eventName));
}
}
getPosts: function () {
this.setState({
posts: [],
searching: true
});
this.helper.setQuery(this.state.keyword).search();
Mixpanel.trackWithProperties('Search', {
keyword: this.state.keyword
});
},
trackWithProperties(eventName, props) {
if (__DEV__) return
if (!MainStore.appState.allowDailyUsage) return
Mixpanel.trackWithProperties(eventName, props, TOKEN_API)
}
}
componentDidMount: function () {
this.fetchData();
this.getStarredPosts();
BackAndroid.addEventListener('hardwareBackPress', this.navigatorPop);
GoogleAnalytics.trackScreenView('Post Page');
Mixpanel.trackWithProperties('View Post', {
post_title: this.props.post.name
});
},
componentDidMount: function() {
BackAndroid.addEventListener('hardwareBackPress', this.navigatorPop);
GoogleAnalytics.trackScreenView('WebView');
Mixpanel.trackWithProperties('WebView', {
url: this.props.url,
title: this.props.title
});
},