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

Fix visitor WP login status information in dataLayer

    XporterXMLWordPrintable

    Details

    • Type: Task
    • Status: CLOSED
    • Priority: Should have
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.13
    • Labels:
      None
    • Story Points:
      2
    • Sprint:
      Sprint #115
    • Section:
      Analytics
    • P4 site:
      All sites
    • Track:
      Development
    • Repositories:
      planet4-master-theme

      Description

      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 Stefan Duerrenberger 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  

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: