This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Adding Google Analytics tracking code to form


  1. Regardt
    Member

    Hi,

    How do i, insert tracking text my form? I'm linking to this form from the website.

    Thanks

    I have seen the posts with regards but it's only applicable to iframes usage.

    Posted 16 years ago #
  2. yuniar

    Open your includes/view-functions.php file.

    Inside display_form() function, around line 1827-1833 you'll find this:

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>{$form->name}</title>
    <link rel="stylesheet" type="text/css" href="{$css_dir}view.css" media="all" />
    <script type="text/javascript" src="js/view.js"></script>
    {$calendar_js}
    </head>


    Simply insert your tracking code between those head tags.


    MachForm Founder

    Posted 16 years ago #
  3. philwareham
    Member

    Hi,
    Google seem to want their analytics code placed just before the body close tag (though I guess it make no difference really), so you could place the tracking code between lines 1854 and 1855 of includes/view-functions.php if you wish.

    Posted 16 years ago #
  4. Regardt
    Member

    Hi, Thanks for the quick response.

    Question: how will this code know which form to to track. I have 20 forms and only 1 needs this code?

    Posted 16 years ago #
  5. yuniar

    Yes, this code will track all your forms. Each of them with its own id number.


    MachForm Founder

    Posted 16 years ago #
  6. aavitabile
    Member

    Hello! I was hoping to confirm the set up of Google Analytics in 3.5. I found the includes/view-functions.php file, and in the code, 4 instances of the <head> tag. Should I add the path to my GA code in each instance? ie, <script type="text/javascript" src="../js/google-analytics.js"></script>?

    Thanks! Amy

    Posted 10 years ago #
  7. yuniar

    Yes, you should add the path to all head instances.


    MachForm Founder

    Posted 10 years ago #

RSS feed for this topic

Reply