Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When I add a function to _paq that is supposed to set custom variables, I cannot read the variables first. Due to the fact that the siteId is pushed to _paq it is not set for any function that I added beforehand. Solution would be to unshift the setSiteId call instead of pushing it into the array:
$script .= '_paq.unshift(["setSiteId", ' . drupal_to_js(variable_get('piwik_site_id', '')) . ']);';
This way, the siteId is available when getCustomVariablesFromCookie() or getCookieName() is called.
Comments
Comment #1
hass CreditAttribution: hass commentedVery unhelpful comment.
See http://piwik.org/docs/javascript-tracking/#toc-custom-variables
Comment #1.0
hass CreditAttribution: hass commentedadding code tags