Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • krmmalik

    (@krmmalik)

    Did you have any luck with this?

    I want to do dynamic tracking of my filled in forms too, and i have tried variations of the gaq.push code with no luck.

    I’d be grateful for any response

    krmmalik

    (@krmmalik)

    I think i’ve solved it by doing the following

    on_sent_ok: " var x=window.location.pathname+'CallbackFormFilled';var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-12632112-1']);_gaq.push(['_trackPageview', x]);"

    Seems to be working in terms of the form but i wont get stats till tomorrow

    krmmalik

    (@krmmalik)

    I keep getting “_gaq is not defined” even if i store the pathname and concatenate the string into a variable first

    here’s an example:

    on_sent_ok: " var x=window.location.pathname+'CallbackFormFilled'; _gaq.push(['_trackPageview', x]);"'

    krmmalik

    (@krmmalik)

    So i tried PHP echo, but it doesnt look like i can execute any PHP code in the hook, i also have no previous PHP experience.

    I thought of another idea which was to use the javascript function “window.location.pathname” – I tested that with an alert function which worked fine, and i also concatenated the pathname and a string together to get a unique string for when the send button is pressed. That actually worked quite well, but when trying to apply the same for the trackPageview it fails and i suspect its because my syntax is incorrect, any ideas?

    on_sent_ok: "_gaq.push(['_trackPageview', window.location.pathname+'CallbackFormFilled']);"

    krmmalik

    (@krmmalik)

    OK – The last part of your solution i understand and is exactly what i am after, but would i have to manually setup the $_GET variable for each page, or will that be automatically populated due to the page’s own slug/url?

    It’d be really great if something like this can work – have you had chance to test such a solution? I’ll try implementing it tomorrow.

    krmmalik

    (@krmmalik)

    Thanks for the link, but my implementation is already following those guidelines.

    The issues how i have is my contact form appears on multiple wordpress pages, and therefore the same URL is specified in the javascript action hook to be registered for the goal. What happens as a result of this, is that Google Analytics shows me an inflated number of conversions for my goals since all my goals have the same URL.

    I need to be able to push a different URL to GA for each page the contact form appears on. Obviously i could create a new form for each page, but its more work but if thats what i have to do then so be it.

    krmmalik

    (@krmmalik)

    Can this be used with the javascript hook?

    Currently i’m using “on_sent_ok” to push a pageview to Google Analytics for goal tracking but my goal URL on all pages is the same.

    Here is my code :

    on_sent_ok: "_gaq.push(['_trackPageview', '/ContactFormFilled']);"

    I could really do with passing the URL parameter in there if its do-able?

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