Tagged: x
-
AuthorPosts
-
October 5, 2016 at 9:40 am #1203485
Manny CostalesParticipantHi, I’m trying to add the Active Campaign Tracking Code, but I don’t know where should I add it.
Where is the best place to put a tracking code without adding a new plugin?October 5, 2016 at 9:52 am #1203505
ThaiModeratorHi There,
Please add the following code under functions.php file locates in your child theme:
add_action( 'wp_head', 'add_custom_script' ); function add_custom_script(){ ?> <script type="text/javascript"> /* Your Scrip Will Go Here */ </script> <?php }Hope it helps 🙂
October 5, 2016 at 11:20 am #1203652
Manny CostalesParticipantThanks, but I have to put in the the footer (wp_footer), because in the header it broke my page, I lost my styles, fonts were crazy, image sizes…..
why?October 5, 2016 at 11:47 am #1203685
ThaiModeratorIn this case, please try with this code instead:
add_action( 'wp_footer', 'add_custom_script' ); function add_custom_script(){ ?> <script type="text/javascript"> /* Your Scrip Will Go Here */ </script> <?php }Could you please provide us with your tracking code?
Thanks.
October 5, 2016 at 3:12 pm #1203973
Manny CostalesParticipantthat’s what I did,
thanksOctober 5, 2016 at 6:35 pm #1204162
JadeModeratorYou’re welcome.
January 21, 2017 at 4:14 pm #1339923
adam hParticipantHi, sorry I am interested in this topic as well. However, I’m not exactly sure where to place the code or what the code should look like?
Also, do I place it here:
January 21, 2017 at 4:15 pm #1339925
adam hParticipantThis reply has been marked as private.January 21, 2017 at 11:17 pm #1340163
ChristopherModeratorHi there,
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Please connect to FTP and add following code in child theme’s functions.php file :
function my_custom_footer_output() { ?> <!– Active Campaign Tracking Pixel Code –> <script> var trackcmp_email = "; var trackcmp = document.createElement("script"); trackcmp.async = true; trackcmp.type = 'text/javascript'; trackcmp.src = '//trackcmp.net/visit?actid=251631999&e='+encodeURIComponent(trackcmp_email)+'&r='+encodeURIComponent(document.referrer)+'&u='+encodeURIComponent(window.location.href); var trackcmp_s = document.getElementsByTagName("script"); if (trackcmp_s.length) { trackcmp_s[0].parentNode.appendChild(trackcmp); } else { var trackcmp_h = document.getElementsByTagName("head"); trackcmp_h.length && trackcmp_h[0].appendChild(trackcmp); } </script> <!– End Active Camapaign Pixel Code –> <?php } add_action( 'wp_footer', 'my_custom_footer_output', 99999 );Hope it helps.
January 22, 2017 at 4:27 pm #1340759
adam hParticipantChristopher,
Thanks for the tip. I must admit I am a novice website builder and this function.php has me a little stumped.
I’ve taken your advice and uploaded the child theme, then I found my way through the editor section and pasted the code you provided under the additional functions section.
https://www.screencast.com/t/5aNfm2XiTf
I updated the file – Went to the page to check the status of the tracking pixel – However, it does not appear to be tracking
https://www.screencast.com/t/LR0K12chs0VI
Question 1 – Is this the correct place to paste the tracking pixel?
Here is my tracking code
<script type=”text/javascript”>
var trackcmp_email = ”;
var trackcmp = document.createElement(“script”);
trackcmp.async = true;
trackcmp.type = ‘text/javascript’;
trackcmp.src = ‘//trackcmp.net/visit?actid=251631999&e=’+encodeURIComponent(trackcmp_email)+’&r=’+encodeURIComponent(document.referrer)+’&u=’+encodeURIComponent(window.location.href);
var trackcmp_s = document.getElementsByTagName(“script”);
if (trackcmp_s.length) {
trackcmp_s[0].parentNode.appendChild(trackcmp);
} else {
var trackcmp_h = document.getElementsByTagName(“head”);
trackcmp_h.length && trackcmp_h[0].appendChild(trackcmp);
}
</script>The site is currently in development – here is the url: http://029.071.myftpupload.com/
Thank you
Adam
January 22, 2017 at 4:49 pm #1340780
adam hParticipantIt looks like now I am consistently getting a parse error
Parse error: syntax error, unexpected ‘<‘ in /home/content/p3pnexwpnas04_data01/52/3800452/html/wp-content/themes/x-child/functions.php on line 29
January 22, 2017 at 9:11 pm #1340986
Rue NelModeratorHello There,
Would you mind providing us with login credentials so we can take a closer look and fixed this issue? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / password
– FTP credentialsDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thank you.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1203485 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
