Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi Andrija,

    The plugin does not have built-in support for google analytics event tracking. However, there are a few different PHP- / WordPress-based action hooks that you could attach custom code to, including embedding JavaScript code. I would suggest checking out the process_form_submission.php page where we’ve included the following actions:
    yikes-mailchimp-after-submission
    yikes-mailchimp-after-submission-$form_id
    yikes-mailchimp-form-submission
    yikes-mailchimp-form-submission-$form_id

    Would this help solve your current task?

    Also, you’re not the first person to ask for Google Analytics (or similar software) support, so we hear you and will try to prioritize that.

    Hope that helps,
    Kevin.

    Edit: Andrija, I answer a similar question in this thread (https://wordpress.org/support/topic/javascript-subscribed-event/) and thought that may be worth reading through.

    • This reply was modified 9 years, 6 months ago by yikesitskevin.
    Thread Starter Andrija Kokanovic

    (@kokan87)

    Hi Kevin,

    Thanks for the heads up, I will look into these hooks.

    It would be very helpful to have that option out of the box inside the plugin or at least well documented somewhere (knowledge base for example) like mc4wp has it.

    Cheers,
    Andrija

    Plugin Contributor Tracy Levesque

    (@liljimmi)

    🏳️‍🌈 YIKES, Inc. Co-Owner

    Hi Andrija,

    We have added this to our to-do list.

    Thank you for the suggestion!
    -Tracy

    Thread Starter Andrija Kokanovic

    (@kokan87)

    Tnx, Tracy, I appreciate it!

    And for all of you that want to do this, this is how I solved it:

    add this into functions.php (I used child theme):

    
    function whatever_you_want(){ ?>
    		<script>
    			ga('send', {
    			  hitType: 'event',
    			  eventCategory: 'Category',
    			  eventAction: 'Action',
    			  eventLabel: 'Label'
    			});
    		</script>
    	<?php 
    add_action( 'yikes-mailchimp-after-submission-1', 'whatever_you_want' );
    
    

    NOTE:
    yikes-mailchimp-after-submission-1 – Replace the last number (1) with the ID of your form

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @kokan87,

    If you’re still looking for it, better support for Google Analytics has been added.

    Check out this article from our knowledge base: https://yikesplugins.com/support/knowledge-base/add-google-analytics-event-tracking/.

    Cheers,
    Kevin.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Adding Google Analytics event tracking’ is closed to new replies.