Ad

Google Tag Manager And Firebase Analytics Tag Not Working On Android Device

So this is pretty much my first time setting up google tag manager and it's been quite confusing. I understand that tags are used to trigger actions such as adding events onto an analytic tool or running a custom function on an app.

So after setting up firebase analytics and google tag manager , i was wondering how to test out the tags as i see all events are constantly being saved on to firebase anyways. I chose to test Event Blocking nevertheless. After setting up the code and doing a preview debug, its apparently that the events are not being blocked and still being tracked. What am i doing wrong ?

Here is my main code on android,

package com.napmi.testtagmanager;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import java.util.Calendar;
import java.util.Date;

import com.google.firebase.analytics.FirebaseAnalytics;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    private FirebaseAnalytics mFirebaseAnalytics;
    private Button btnApple;
    private Button btnOrange;
    private Button btnLemon;
    private Button btnEvent;
    private String name = "Eric";
    private String text = "this is a bunch of text";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        // Obtain the FirebaseAnalytics instance.
        mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
        btnApple = findViewById(R.id.btnApple);
        btnOrange = findViewById(R.id.btnOrange);
        btnLemon = findViewById(R.id.btnLemon);
        btnEvent = findViewById(R.id.btnEvent);
        btnApple.setOnClickListener(this);
        btnOrange.setOnClickListener(this);
        btnLemon.setOnClickListener(this);
        btnEvent.setOnClickListener(this);
    }

    public void sayTrigger(){
        Toast.makeText(this,"WHOA IT TRIGGER ",Toast.LENGTH_SHORT).show();

    }

    @Override
    public void onClick(View view) {
        Date currentTime = Calendar.getInstance().getTime();
        switch(view.getId()){
            case R.id.btnApple:
                Bundle appleBundle = new Bundle();
                mFirebaseAnalytics.logEvent("add_apple", appleBundle);
                Toast.makeText(this,"Apple press",Toast.LENGTH_SHORT).show();
                break;
            case R.id.btnOrange:
                Bundle orangeBundle = new Bundle();
                mFirebaseAnalytics.logEvent("add_orange", orangeBundle);
                Toast.makeText(this,"Orange press",Toast.LENGTH_SHORT).show();
                break;
            case R.id.btnLemon:
                Bundle lemonBundle = new Bundle();
                mFirebaseAnalytics.logEvent("add_lemon", lemonBundle);
                Toast.makeText(this,"Lemon press",Toast.LENGTH_SHORT).show();
                break;
            case R.id.btnEvent:
                Bundle params = new Bundle();
                params.putString("image_name", name);
                params.putString("full_text", text);
                mFirebaseAnalytics.logEvent("share_image", params);
                break;
            default:
                break;
        }
    }
}

Attached is my google tag manager setting for the tag.Tag SettingTrigger setting

Ad

Answer

Just found out. Google told me to put it at app/main/assets/containers but it turns out its suppose to be on app/src/main/assets/containers good job... Good Night everyone.

Ad
source: stackoverflow.com
Ad