<?php

namespace KupShop\ElninoBundle\GTMv1\PageType;

class CommonPageType extends \KupShop\GTMOldBundle\PageType\CommonPageType
{
    public function getUserData()
    {
        $user = parent::getUserData();

        if (logged()) {
            $userObj = \User::getCurrentUser();
            $user->userID = $userObj->id;
            if ($userObj->email) {
                $user->email = $userObj->email;
                $user->shaEmail = substr(hash('sha256', $userObj->email), 0, 32);
            }
        }

        return $user;
    }

    public function getTagParamsData(&$dataContainer)
    {
        $dataContainer->google_tag_params = new \stdClass();
    }
}
