Android Tag Manager not working

I'm having trouble implementing the new google tag library.

Here is what I did:

  • I am creating a dataleyr macro
  • I set a rule for the event
  • I create a tag and set a universal analytics identifier on it
  • I publish my container

Then I tried to use it in my application like this

TagManager mTagManager = TagManager.getInstance(this);

DataLayer mDataLayer = com.google.android.gms.tagmanager.TagManager.getInstance(this).getDataLayer();

ContainerOpener.openContainer(
    mTagManager, CONTAINER_ID, OpenType.PREFER_NON_DEFAULT,
    TIMEOUT_FOR_CONTAINER_OPEN_MILLISECONDS, new ContainerOpener.Notifier() {

        @Override
        public void containerAvailable(Container container) {
            container.refresh();
            // Save container for use by any other activities in the app.
            com.appsconceptelite.appsconceptelite.testfunctionnalities.gtm.ContainerHolder.setContainer(container);

            mContainer = com.appsconceptelite.appsconceptelite.testfunctionnalities.gtm.ContainerHolder.getContainer();

            Utils.pushOpenScreenEvent(LearnActivity.this, "Learn Screen");
        }
    });

and the method that I use to click the event,

/**
 * Push an "openScreen" event with the given screen name. Tags that match that event will fire.
 */
public static void pushOpenScreenEvent(Context context, String screenName) {

    DataLayer dataLayer = TagManager.getInstance(context).getDataLayer();

    dataLayer.pushEvent("openScreen", DataLayer.mapOf("screenName", screenName));
}

When I run this code in debug mode, I get the correct name and version of the container, but when I check the dashbord in Google Analytics, I do not see events as if the data were not clicked.

Can you tell me what I'm doing wrong?

+4
source share
1 answer

, , , Google Analytics, " ", , . " " .

0

Source: https://habr.com/ru/post/1541114/


All Articles