• I need to track how many inquiries comes from the website through the contact form.

    Searching through forums I could only find a hack how to disable the Ajax and send the user to a “thank you” page instead.

    Google Analytics, however, says Javascript events can be tracked even if the user is not sent to a “thank you” page:

    https://www.google.com/support/googleanalytics/bin/answer.py?answer=55521

    By using the _trackPageview function, you can assign a page filename to any Javascript event.

    To track an event, call _trackPageview() with an argument specifying a name for the event. For example:

    pageTracker._trackPageview(“/homepage/link1”);

    HTML Code Examples

    The following illustrates how to log an onClick event:

    Trouble is I have no clue where this code would be added and exactly how it would look. Any help appreciated!!

Viewing 10 replies - 16 through 25 (of 25 total)
  • There are two Analitics codes in your source. You should remove one of them.

    This should work.

    on_sent_ok "pageTracker._trackPageview('/contactforms/main/lead');"

    I removed it, still nothing.

    Should I try to put the Google Analytics code at the top (only)?

    How did you test that? Google Analytics takes a few days to show.

    BuzzMaven

    (@sitecreations)

    giving it more time then.

    Hi

    Is there anyway of testing the on_sent_ok hooks as I’ve set up the goals and funnels in analytics but cannot seem to get it to trigger.

    It’s basically tracking an adwords campaign and i’m needing to track who submitted info via the contact from depending on which landing page they came from.

    The funnel is:
    1. Google landing page
    2. contact form
    3. the on sent ok hook from contact form 7

    Any advice would be much appreciated.
    thanks
    Vin

    Hello — Like KidAlynch and exodo the confirmation box goes away (in Firefox and IE) when I add the following code to the additional settings on my contact form.

    on_sent_ok: pageTracker._trackPageview(“/Contact/Send”);

    Interestingly when I add this line — on_sent_ok: “alert(‘TEST’);” — the confirmation box does not go away. I’m not using the Google Analytics for WordPress plugin as refinedinternet above says caused his problem. I would really like to be able to track contact form submissions so that I can run an Adwords campaign and I like the ContactForm7 plugin other than this issue and would rather not have to change. Can anyone help me figure out how to get the confirmation box back and run the GA _trackpageview code.

    This is the form in question — https://www.blissfuldogowner.com/contact/

    Thanks.

    on_sent_ok: pageTracker._trackPageview(“/Contact/Send”);

    Look carefully. The correct input should be:

    on_sent_ok: "pageTracker._trackPageview('/Contact/Send')";

    See
    Tracking Form Submissions with Google Analytics

    looking at the sourcecode of other pages with problems the only script everyone seems to have in common is jquery – unlikely to be the cause?

    No answer I’m afraid but I do have some information.

    The issue I am having is similar to many people above. When I add the pageTracker code to the on_sent_ok code the verification box no longer appears.

    on_sent_ok: "pageTracker._trackPageview('/contact/sidebar-success.html');"

    This is indeed because of a Javascript error. The error is:

    Uncaught ReferenceError: pageTracker is not defined

    So basically it is trying to resolve the reference before the Google JS. However as the Google JS is already on the page and is being correctly called I’m a little lost as this variable is getting introduced via the AJAX call on correct form submission.

    In my case it is from a page called “articles” so the headers are:

    Request URL:https://www.mysite.com/articles/#wpcf7-f1-t1-o1
    Request Method:POST
    Status Code:200 OK

    And the content of that is:

    { "mailSent": 1, "into": "#wpcf7-f1-t1-o1", "captcha": { "captcha-163": "https://www.mysite.com/wp-content/uploads/wpcf7_captcha/896030197.png" }, "message": "Your message was sent successfully. Thanks.", "onSentOk": ["pageTracker._trackPageview(\'/contact/sidebar-success.html\');"] }

    Hope this is a clear enough explanation of the problem.

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘[Plugin: Contact Form 7] Google Analytics goals using the using the _trackPageview function’ is closed to new replies.