laravel-gamp icon indicating copy to clipboard operation
laravel-gamp copied to clipboard

setUserId doesnt work

Open oligirling opened this issue 4 years ago • 2 comments

I cannot seem to get setUserId to work.

The package this extend (https://github.com/theiconic/php-ga-measurement-protocol#usage) allows for setUserId as well as setClientId. But it seems using setUserId doesnt seem to work.

Any idea why this is?

oligirling avatar Oct 19 '19 16:10 oligirling

Please share your current code, it'll help in debugging the issue.

irazasyed avatar Oct 19 '19 17:10 irazasyed

Thanks for the reply.

So this works as expected:

        $gamp = GAMP::setClientId( $userId );
        $gamp->setEventCategory($category)
            ->setEventAction($request->route()->getName())
            ->setEventLabel($label)
            ->setIpOverride($request->getClientIp())
            ->sendEvent();

But this does not work:

        $gamp = GAMP::setUserId( $userId );
        $gamp->setEventCategory($category)
            ->setEventAction($request->route()->getName())
            ->setEventLabel($label)
            ->setIpOverride($request->getClientIp())
            ->sendEvent();

oligirling avatar Oct 21 '19 11:10 oligirling