I know what you’re thinking, it can’t really be that difficult to add Google Analytics javascript tracking code to Post Affiliate Pro 4 (PAP4). When I first attempted to add my tracking code to the site. I got an error message and I didn’t know why I was getting one.
My original suspicion was that a variable in my Google Analytics code was conflicting with a variable in my Post Affiliate Pro 4 software. Well, I’m writing this article to tell you I was completely wrong about that one.
The real reason for the error is a whole lot simpler to solve than you think. After submitting a support ticket to Post Affiliate Pro’s help center, I got a reply back a few days later. I was told the reason why the Google Analytics code was causing errors was because of the way I was putting the code into the site.
PAP4 uses smarty syntax templates and you can’t just add Google Analytics code into pages as is. You’ll need to surround the Google Analytics code with the following tags:
{literal}{/literal}
I got more good news for you. There are only two spots you’ll need to add your Google Analytics tracking script code. Once in the footer.stpl file in the affiliates area and one more in the footer.stpl on the sign up form. You don’t need to track the merchant area, because that’s just you.
Having Google track your affiliate program will decrease the bounce rate of your website. Affiliate will come back to your site over and over again to track their earnings and stay logged in a lot of times. This will show Google that your website has more relevance than a regular old static website.
You could manually input the code on your sever, but Post Affiliate Pro 4 makes it really easy to edit the footer.stpl files right from your merchant back office.
Just go to Configuration, Affiliate Sign up, Custom Design, then Edit Footer for the sign up form.
Go to Configuration, Affiliate Panel, Customize Design, then Edit Footer to put the code in the affiliate area.
Simply put the javascript code at the bottom of both footer.stpl files. Your code will look like this (note: my tracker ID has been covered):
{literal}
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-317xxxx-1");
pageTracker._trackPageview();
} catch(err) {}</script>
{/literal}
Related Posts:
- How to use javascript to make your GetResponse subscription form check fields
- Properly set up your WordPress blog for seo, speed, monetization, traffic, and the minimum required plugins and sites you’ll need to make it happen
- My experience setting up Post Affiliate Pro 4 not too bad
- List of 14 WordPress plugins your blog should have installed
- How to add Alertpay as a pay out option in Post Affiliate Pro
Tags: Affiliate Program, Affiliates Area, Decrease Bounce Rate, Error Message, Footer.stpl, Google Analytics, Javascript Tracking Code, Merchant Area, PAP4, Post Affiliate Pro 4, Sign Up Form, Smarty Syntax, Templates, Tracking Code, Variable
Thanks for the tip–it worked great!
[Reply]