AdWords
5.5K members online now
5.5K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

Add Conversion Tracking Code to same page

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I am using php contact form method. I add a popup thank you message, when my form is submitted. How can i add conversion tracking code in that page?   

 

My php code are something like this -

 

<?php

if(isset($_POST['cfsubmit'])){    
    
if(!$errorExists){
    $fancymessage = "<div id='c_confirm'>Thank you for contacting With us. One of our customer service representatives will get back to you within 24 hours.</div>";
    ?>
    <script>
    jQuery(document).ready(function(){
        jQuery.fancybox("<?php echo $fancymessage; ?>");
    });
    </script>
    <?php

                $emailTo = "myemail@mysite.com";

------------------------------

-------------------------------

 

 

1 Expert replyverified_user

Re: Add Conversion Tracking Code to same page

Explorer ✭ ✭ ✭
# 2
Explorer ✭ ✭ ✭
In this situation you can track conversions using Event base Goals in Google Analytics;

You will have to generate an event whenever user clicks on the button to submit a form, using the event tracking script. Once event is set up then you can define event base goal in Google analytics. Whenever an event will occur a conversion will be counted. You can import this goal into your Adwords account and then Adwords will start reporting conversions in reports.

Guide for setting up events is bellow;

For Classic Analytics = https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide

For Universal Analytics= https://developers.google.com/analytics/devguides/collection/analyticsjs/events

Thanks,

Re: Add Conversion Tracking Code to same page

Top Contributor
# 3
Top Contributor
Hi Manish C,

The easiest thing to do is return just the image portion of the conversion code with the fancy message.

Best of Luck!

Pete
petebardo -- Deadhead doing AdWords

Re: Add Conversion Tracking Code to same page

[ Edited ]
Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

I just add the conversion code between

if(!$errorExists){ 

 

 

    <script>
    jQuery(document).ready(function(){
        jQuery.fancybox("<?php echo $fancymessage; ?>");
    });
    </script>

//GA Conversion Code

 

}

Is that work?




Re: Add Conversion Tracking Code to same page

Top Contributor
# 5
Top Contributor
Hi Mannish C,

I don't think that will work. Scripts returned with a call back (AJAX) do not run, and neither does the noscript portion. Just return the image part of the code with $fancymessage.

Pete
petebardo -- Deadhead doing AdWords