Good afternoon,

I was wondering whether anyone might know how to change the submit input button code using the Composer Template?

Basically I have been asked to change this code

input type="submit" name="submit" value="Submit"

With the following:

input type="submit" name="submit" value="Submit" onClick=”ga(‘send’, ‘event’, ‘Contact Form’, ‘Form Submit’);"

to allow my client to track the Submit button through Google Analytics.

I presume it's something that needs adding in the code below?

Many thanks in advance for shedding any light on this issue!

            <div class="line">
                <div class="unit size1of{composer:column_total}">
                {if composer:field_total == 0}
                {if composer:field_label}
                    {if composer:field_type == 'nonfield_captcha'}
                        {if freeform:captcha}
                        <label class="field_label" {if composer:field_name != ''}for="freeform_{composer:field_name}"{/if}>
                            {composer:field_label}{if composer:field_required}<span class="required_item">*</span>{/if}
                {if composer:field_output}
                    {if composer:field_type == 'nonfield_title'}
                    {if:elseif composer:field_type == 'nonfield_captcha'}
                        {if freeform:captcha}
                                {freeform:captcha}<br />
                                <input type="text" name="captcha" value=""
                                       size="20"   maxlength="20" style="width:140px;" />

1 Answer 1


An alternative, as I'm not too familiar with composer and I don't know where the composer tags put the submit button out with, and as the composer/multipage mode could put out multiple 'submit' buttons...

Use this below Jquery snippet to add what you want to all the submit buttons of the form in question. You don't include the outer freeform tag pair so for this example I'm going to assume you've used the form_id parameter. For this example lets say the form has the id of my_freeform_form.

Pop this underneth your freeform tags (I also assume you have jQuery available)...

<script type="text/javascript">
  $('form#my_freeform_form input[type=submit]').click(function(e){
    if ( ga ) { //saftey, is ga existing?
      ga(‘send’, ‘event’, ‘Contact Form’, ‘Form Submit’);
    //important, return true to allow the 'normal' 
    //form submit through after we're done
    return true; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.