Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Plugin Integration for Mailchimp #8571

Open
5 tasks
zutigrm opened this issue Apr 17, 2024 · 3 comments
Open
5 tasks

Add Plugin Integration for Mailchimp #8571

zutigrm opened this issue Apr 17, 2024 · 3 comments
Assignees
Labels
P0 High priority Squad 1 (Team S) Issues for Squad 1 Type: Enhancement Improvement of an existing feature

Comments

@zutigrm
Copy link
Collaborator

zutigrm commented Apr 17, 2024

Feature Description

Mailchimp conversion events should be supported in the new conversion event tracking infrastructure.

See implementation and class design and plugin specific notes section in the design doc


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Conversion events from Mailchimp should be tracked and supported by our infrastructure.
  • When Mailchimp form is submitted, a conversion event - submit_lead_form should be tracked.

Implementation Brief

  • Add Google\Site_Kit\Core\Conversion_Tracking\Conversion_Event_Providers\Mailchimp
    • It should implement Google\Site_Kit\Core\Conversion_Tracking\Conversion_Events_Provider interface.
    • Define class property conversion_provider_slug with a value, say mailchimp
    • It should have following methods:
      • is_active - check if MC4WP_VERSION constant is defined
        • return true if it is
        • otherwise return false
      • get_event_names - return an associative array contain one string submit_lead_form
      • register_script - Instantiate the Google\Site_Kit\Core\Assets\Script class and register the script, leveraging the execution argument for deferring the script. It should return the Script instance.
        • You can see an example of instantiating the Script class here
          new Script(
          'googlesitekit-polyfills',
          array(
          'src' => $base_url . 'js/googlesitekit-polyfills.js',
          'dependencies' => array(
          'googlesitekit-base-data',
          ),
          )
          ),
        • Use mc4wp-forms-api script as dependency
        • Include 'execution' => 'defer'
        • For handle name use gsk-cep-{$this->conversion_provider_slug}
        • return the Script instance
  • Add assets/js/event-providers/mailchimp.js
    • Include the Mailchimp specific event listener that will trigger the event once document is loaded. Mailchimp uses custom event handling, so this is the way to attach event listener:
mc4wp.forms.on('subscribed', function(form) {
  // gtag.js
  gtag('event', 'submit_lead_form', {'event_category': 'Mailchimp', 'event_label': 'Name: ' + form.name + ' ID: ' + form.id});
});

Test Coverage

  • You can add basic test coverage for Mailchimp class, testing that get_event_names method returns correct event names, and register_script returns script instance with proper handle. Also is_active method can be confirmed by defining the plugin constant

QA Brief

Changelog entry

@zutigrm zutigrm added Type: Enhancement Improvement of an existing feature Squad 1 (Team S) Issues for Squad 1 labels Apr 17, 2024
@zutigrm zutigrm assigned zutigrm and unassigned zutigrm Apr 17, 2024
@eclarke1 eclarke1 added the P0 High priority label Apr 17, 2024
@eugene-manuilov eugene-manuilov self-assigned this Apr 17, 2024
@eugene-manuilov
Copy link
Collaborator

@zutigrm, similarly to the CF7 integration, we need to specify exact events that we expect to be triggered after this integration is implemented.

@eugene-manuilov
Copy link
Collaborator

AC ✔️

@eugene-manuilov eugene-manuilov removed their assignment Apr 17, 2024
@zutigrm zutigrm assigned zutigrm and unassigned zutigrm Apr 18, 2024
@eugene-manuilov eugene-manuilov self-assigned this Apr 18, 2024
@eugene-manuilov
Copy link
Collaborator

IB ✔️

@eugene-manuilov eugene-manuilov removed their assignment Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority Squad 1 (Team S) Issues for Squad 1 Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants