Uploaded image for project: 'Planet4'
  1. Planet4
  2. PLANET-4591

Fix visitor WP login status information in dataLayer

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Should have Should have
    • 2.13
    • 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  

            sdeshmuk Sagar Deshmukh
            jmarubay Julia Marubayashi
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: