Hi,
I have a custom token that I'm trying to use as a custom dimension value. I'm setting the custom token on a dynamic page via token_replace(). I can verify that the token is getting set, but it's not getting set in ga() by the Google Analytics module even though it's defined in the module config.

I've used default tokens as custom dimensions with no problem before, so I'm wondering if someone can help me out. I'm not sure if the problem is that the module doesn't support custom tokens. Thanks!

Comments

dmudie created an issue. See original summary.

hass’s picture

Status: Active » Fixed

See google_analytics.tokens.inc

dmudie’s picture

Status: Fixed » Active

Thanks but that doesn't really help me. I'm using my own custom module to create a custom token. I'm setting the token in the same way as the google analytics module and can verify that the token is set. However, when I want to use this token as a custom dimension, it does not get added. Any help is appreciated.

hass’s picture

Project: Google Analytics » Token
Version: 7.x-2.4 » 7.x-1.x-dev
Component: User Interface » Code

There is no code in this module that blocks you from doing this. So you need to debug yourself or may ask token team.

dmudie’s picture

Project: Token » Google Analytics
Status: Active » Closed (works as designed)

Update. I found the problem. For a dynamically-created page that has no entry in the menu, nothing will be returned by the menu_get_object function, and as a result, nothing get set in the $data array for token_replace. I have a workaround for my case.