-
Task
-
Resolution: Fixed
-
Should have
-
None
-
2
-
Analytics
-
Sprint #115
User stories
- As a data analyst, I want to capture WP visitor login data (true/false) on Planet 4 websites
- As a data analyst, I want to capture WP visitor role information (editor; author; etc).
Problem:
The dataLayer values for signedIn and visitorType are not working properly on Planet 4 websites. We should fix the variables above to capture login (true/false) and user/visitor type (editor, admin, author, etc).
(See screenshot attached to the ticket)
Instructions:
The dataLayer script should be fixed in all pages.
- Fix signedIn value to 'true' or 'false' depending on WP login status.
- Fix visitorType value to send WP visitor roles information (e.g. editor; admin; author, etc).
If the value is empty (meaning that the visitor is not logged in) we can send the value "Guest"
DataLayer script:
dataLayer.push({
'signedIn' : '[value should be true or false]',
'visitorType' : '[value should be according to the visitor role]',
});
Extra resources:
**The master stduerre shared a piece of code from a plugin that extracts this information and send it via dataLayer:
https://github.com/duracelltomi/gtm4wp/blob/d45bac3b7964810e54a7403f1f0cbca1f3c5c9f5/public/frontend.php#L162-L180
Hope this helps