Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
com.uphyca.galette:galette
Advanced tools
Annotation-triggered tracking along with Google Analytics.
Annotation-triggered tracking along with Google Analytics for Android.
@SendEvent(category = "HelloWorld", action = "sayHello", label="%1$s")
String sayHello (String name) {
return format("Hello, %s.", name);
}
Before using GAlette, make sure you have done following instructions described in https://developers.google.com/analytics/devguides/collection/android/v4/
Add the GAlette plugin to your buildscript
's dependencies
section and apply the plugin:
buildscript {
repositories {
...
mavenCentral()
}
dependencies {
...
classpath 'com.uphyca.galette:galette-plugin:0.9.16'
}
}
...
apply plugin: 'com.uphyca.galette'
Implements TrackerProvider to your Application class
public class MyApplication extends Application implements TrackerProvider {
private Tracker mTracker;
@Override
public void onCreate() {
super.onCreate();
GoogleAnalytics ga = GoogleAnalytics.getInstance(this);
mTracker = ga.newTracker(R.xml.your_tracker_resource);
}
@Override
public Tracker getByName(String trackerName) {
return mTracker;
}
}
Declare your application in AndroidManifest.xml.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.uphyca.example.galette">
...
<application
android:name=".MyApplication" ...>
...
</application>
</manifest>
Annotate @SendScreenView to your methods to track appView
public class MainActivity extends Activity {
@Override
@SendScreenView(screenName = "main")
protected void onCreate(Bundle savedInstanceState) {
...
}
}
Annotate @SendEvent to your methods to track event
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
...
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
@SendEvent(category = "button", action = "click")
public void onClick(View v) {
onButtonClicked();
}
});
}
}
Use string template to apply method parameters
public class MainActivity extends Activity {
private int mClickCount;
@Override
protected void onCreate(Bundle savedInstanceState) {
...
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onButtonClicked(++mClickCount);
}
});
}
@SendEvent(category = "button", action = "click", label = "times", value = "%1$d")
private void onButtonClicked(int count) {
...
}
}
Use FieldBuilder to build each field value
public class MainActivity extends Activity {
@Override
@SendScreenView(screenName = "foo", screenNameBuilder = BundleValueFieldBuilder.class)
protected void onCreate(Bundle savedInstanceState) {
...
}
public static class BundleValueFieldBuilder implements FieldBuilder<String> {
@Override
public String build(Fields fields, String fieldValue, Object declaredObject, Method method, Object[] arguments) {
// annotation's screenName value paths to fieldValue, in this case 'foo'
return ((Bundle) arguments[0]).getString(fieldValue);
}
}
}
Use HitInterceptor to send arbitrary values
public class MyApplication extends Application implements TrackerProvider, HitInterceptor.Provider {
private Tracker mTracker;
private HitInterceptor hitInterceptor = new HitInterceptor() {
@Override
public void onEvent(EventFacade eventFacade) {
eventFacade.setCustomDimension(1, Build.MODEL);
}
@Override
public void onScreenView(ScreenViewFacade screenViewFacade) {
screenViewFacade.setCustomDimension(1, Build.MODEL);
}
};
@Override
public void onCreate() {
super.onCreate();
GoogleAnalytics ga = GoogleAnalytics.getInstance(this);
ga.setLocalDispatchPeriod(1);
mTracker = ga.newTracker("SET-YOUR-TRACKING-ID");
}
@Override
public Tracker getByName(String trackerName) {
return mTracker;
}
@Override
public HitInterceptor getHitInterceptor(String trackerName) {
return hitInterceptor;
}
}
Following types or these subclasses are supported.
or implements ContextProvider to orbitary classes.
public class MyClass implements ContextProvider {
private Context mContext;
public MyClass(Context context) {
mContext = context;
}
@Override
public Context get() {
return mContext;
}
@SendScreenView(screenName = "my-class")
void foo() {
}
}
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-analytics:${playservicesVersion}"
}
}
See more details ResolutionStrategy - Gradle DSL Version 2.8
-keepclassmembernames class * {
@com.uphyca.galette.SendScreenView *;
@com.uphyca.galette.SendEvent *;
}
-keepclassmembers class * implements com.uphyca.galette.FieldBuilder {
<init>();
}
Copyright 2014 uPhyca, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
FAQs
Annotation-triggered tracking along with Google Analytics.
We found that com.uphyca.galette:galette demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.