Google and Facebook Conversion Codes

Does someone know where to put JS codes to track signups? Google and Facebook both have conversion tracking codes but I am not sure how to handle them.

Thanks.

Quote · 7 Oct 2013

/templates/base/_footer.html

before the </body>

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 7 Oct 2013

But then how would you track the page where the conversion occurs? If I just put it to footer then it will track all pages

Quote · 7 Oct 2013

 

But then how would you track the page where the conversion occurs? If I just put it to footer then it will track all pages

 correct, your speaking of Google Analytics?

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 7 Oct 2013

No, I am talking about conversion tracking code. Its not google analytics.

Quote · 7 Oct 2013

OK, just saying because I track my conversions via that by setting my own goals.

It would help if you posted an example of the code or the sites instructions.

Most JS is inserted into the footer.

In your other post, no one responded to that I would think because we need a bit more info.

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 7 Oct 2013

Actually I just went to Adwords, I would think the code will go in the page as you thought, the thing is what pages.

If your wanting data, e.g. from the join page, have you inserted the code there in "join.php?" 

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 7 Oct 2013

Analytics can track goals by the url matching mechanism, which is really easy to define. Any goal you defined there can then be imported to Google Adwords. However, this method is slow and not very efficient. In both Google Adwords and Facebook, you can create a goal to track leads. If I want to track number of signups, I can create a goal in Google Adwords and then set my bids to CPC enhanced to automatically bid for the keywords that convert well for me. Unfortunately, this method requires you to put JS code where the lead occurs. So no url matching mechanism applies.

My lead occurs when the user registers on the main page and redirected to /m/avatar/&join_text=_EMAIL_CONF_SENT

As you can see I need to put the JS code of this page. When I put a code there, I will then create a different goal to track how many of my users purchase credits on my site. This happens on a different page. 

Instead of putting JS codes inside different modules, I would like to be able to put somewhere like footer.html as you said. (Would be better if I can echo it from a PHP file). I need to check the url of the current page to make sure the tracking code is on the right page.

 

Quote · 7 Oct 2013

You would use dolphins injections.

You can insert a new injection in the database table sys_injections using the key injection_footer. You can then use php code to check what page url your on and inject the code.

Run this query from phpMyAdmin.

INSERT INTO `sys_injections` (`id`, `name`, `page_index`, `key`, `type`, `data`, `replace`, `active`) VALUES (NULL, 'myinjectionname', '0', 'injection_footer', 'php', '', '0', '1');

Then go to the sys_injections table and edit the injection myinjectionname. Change the name(no spaces in the name), and in the data field you place php code to do what you need to do. Example php code.

$sCode = <<<CODE
PLACE YOUR JAVASCRIPT CODE HERE
CODE;
if($_SERVER['REQUEST_URI'] == '/join.php') {
   echo $sCode;
}

Then clear the dolphin cache. As long as no mistakes were made, your injection will work.


https://www.deanbassett.com
Quote · 7 Oct 2013

I learned something new today.. tried to help as best I could.

Thanks Deano!

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 7 Oct 2013

The code works as promised. Thanks Deano. For people, who might use this in the future, make sure the PHP param is $_SERVER not $SERVER.

Quote · 7 Oct 2013

 

The code works as promised. Thanks Deano. For people, who might use this in the future, make sure the PHP param is $_SERVER not $SERVER.


Correct. I edited my code sample. I typed this in on the fly. No test was done, so i did not notice my mistake.



https://www.deanbassett.com
Quote · 7 Oct 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.