orhanobut / tracklytics

✔️ Annotation based tracking handler with aspect oriented programming
Apache License 2.0
429 stars 45 forks source link

Tracklytics new feature propositions #9

Closed orhanobut closed 8 years ago

orhanobut commented 8 years ago

No tracker implementations

Scope: Method, Parameter Use Attribute to add attributes with dynamic values. There are 2 ways to set this value.

  1. A return value from the method
  2. Method parameter which is passed via method.

Both option accepts null

@Attribute("key") String someMethod(){
   return "value";
}

void someMethod(@Attribute("key") String value){
}

@Attribute("key1") void someMethod(@Attribute("key2") String value1){
   return "value2"
}

Attribute also has a default value option. When the expected value is null, default value will be used

@Attribute(value = "key", defaultValue="value") String someMethod(){
   return null";
}

FixedAttribute

Scope: Class, Method Use it to add fixed values for the attributes

@FixedAttribute(key="Screen Name", value="Login")
public class LoginActivity {

  @FixedAttribute(key="key", value="value") public void foo(){
  }
}

FixedAttributes

Scope: Class, Method Use it to add multiple attributes at once. Java 7 or lower API's don't support repeated annotations.

@FixedAttributes({
  @FixedAttribute(key="key1", value="value1"),
  @FixedAttribute(key="key2", value="value2")
})
public void foo(){
}

Super attributes

Sometimes, you may need to have an application scope attribute and you may want to have this attribute for each event. Attribute and FixedAttribute have an option to make the attribute super. As default it is false, thereby enabling this flag will make the attribute super and it will kept in memory in entire time.

@Attribute(key="key", isSuper=true)
//or
@FixedAttribute(key="key", value="value", isSuper=true)

Deprecated

orhanobut commented 8 years ago

Added in 1.0.0