twitter4jads.models.ads.TwitterEntityStatisticsMetrics Maven / Gradle / Ivy
The newest version!
package twitter4jads.models.ads;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import twitter4jads.models.MetricGroup;
import twitter4jads.models.TwitterSegmentationType;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
public class TwitterEntityStatisticsMetrics {
public static final Set ALL_METRIC_GROUPS;
public static final Map> METRIC_GROUPS_BY_OBJECTIVE;
public static final Set WEB_CONVERSION_METRIC_GROUP = Collections.unmodifiableSet(Sets.newHashSet(MetricGroup.WEB_CONVERSION.name()));
public static final Set ORGANIC_METRIC_GROUPS = Sets.newHashSet(MetricGroup.ENGAGEMENT, MetricGroup.VIDEO);
public static final Set ENGAGEMENT_METRIC_GROUPS = Sets.newHashSet(MetricGroup.ENGAGEMENT);
static {
Set metricGroups = Sets.newHashSet();
for (MetricGroup metricGroup : MetricGroup.values()) {
metricGroups.add(metricGroup.name());
}
ALL_METRIC_GROUPS = Collections.unmodifiableSet(metricGroups);
Map> metricsGroupsByObjective = Maps.newHashMap();
for (TwitterAdObjective adObjective : TwitterAdObjective.values()) {
Set metricGroupNames = Sets.newHashSet();
for (MetricGroup metricGroup : adObjective.getMetricGroups()) {
metricGroupNames.add(metricGroup.name());
}
metricsGroupsByObjective.put(adObjective, metricGroupNames);
}
METRIC_GROUPS_BY_OBJECTIVE = Collections.unmodifiableMap(metricsGroupsByObjective);
}
public static Set getMetricGroups(TwitterSegmentationType twitterSegmentationType) {
if (twitterSegmentationType != null && TwitterSegmentationType.CONVERSION_TAGS == twitterSegmentationType) {
return WEB_CONVERSION_METRIC_GROUP;
}
return ALL_METRIC_GROUPS;
}
/*
Later, when we have MEDIA_CREATIVE Data
*/
public static Set getMetricGroups() {
return ALL_METRIC_GROUPS;
}
}