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

Add dataLayer event and variables to the Form Block

XMLWordPrintable

      This is related to Gabor's ticket: *https://jira.greenpeace.org/browse/PLANET-2836* 

      • As a web editor, I want to insert values on the Form Backend so that I can better identify conversions on Analytics.
      • As a data analyst, I want to start tracking the signups on the Planet 4 pages and be able to identify what kind of conversion or campaign the form is related to. 

      Part 1: Create text or dropdown fields on the Form Backend

      The values chosen by the user will be sent through dataLayer.push method

      Part 2: Send a dataLayer event with parameters defined on the backend:

      Embed an onclick dataLayer.push in the submit button code that will send an event and parameters (values) the were input by the user:

      dataLayer.push({

       'event' : 'petitionSignup'

       'gcampaign' : ‘[value defined in Campaign field]’,

       'gBasket' : ‘[value defined in Basket field]’,

       'gScope': ‘[value defined in Scope field]’,

       'gDepartment': ‘[value defined in Department field]’,

       });

       

      This would automatically collect the "submit" event, and send it to Google Analytics using the GTM configuration.

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

              Created:
              Updated:
              Resolved: