1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Wordpress Thank You Page / Pixel Tracking

Discussion in 'General Programming Chat' started by bobbylove321, Jun 30, 2012.

  1. bobbylove321

    bobbylove321 BANNED BANNED

    Joined:
    Nov 8, 2008
    Messages:
    1,987
    Likes Received:
    2,198
    Hi,

    Does anyone know how I can place the conversion tracking pixel from a cpa / cpv network on a wordpress thank you page?

    I have looked many places for some sort of a plugin but I cannot find any.

    I just want to place the tracking code that the network provided me and put it on the thank you page. (The thank you page is simply a wordpress post)

    Thanks
     
  2. bobbylove321

    bobbylove321 BANNED BANNED

    Joined:
    Nov 8, 2008
    Messages:
    1,987
    Likes Received:
    2,198
    So no one knows how?
     
  3. Zak_A

    Zak_A Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 16, 2008
    Messages:
    808
    Likes Received:
    873
    Gender:
    Male
    Occupation:
    WP designer & developer
    Location:
    Western Europe
    If you can't find a plugin to do that, I have a solution but it may not be easy if your not a bit code-savvy.

    Basically duplicate the "single.php" file of your WP theme and make it a custom post template that you will use with your thank you page; and add your tracking code in this template.
     
  4. bobbylove321

    bobbylove321 BANNED BANNED

    Joined:
    Nov 8, 2008
    Messages:
    1,987
    Likes Received:
    2,198
    That's a bit complicated.

    I would think that it would be easy to place a tracking pixel on a specific wordpress page.
     
  5. OriginalEXE

    OriginalEXE Power Member

    Joined:
    Feb 6, 2012
    Messages:
    634
    Likes Received:
    664
    Occupation:
    WordPress developer
    Home Page:
    I have no idea what your code looks like, but just paste this in single.php

    if(is_single('post-slug')){
    // your tracking code here....
    };

    That's it, then code will execute only on the post with that slug.
     
    • Thanks Thanks x 2
  6. Zak_A

    Zak_A Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 16, 2008
    Messages:
    808
    Likes Received:
    873
    Gender:
    Male
    Occupation:
    WP designer & developer
    Location:
    Western Europe
    That's a better solution, I should have thought about it too ;)
    However the tracking code is probably not php so it should be either echoed or php tags must be open/closed properly such as:

    Code:
    if(is_single('post-slug')){ ?>
    
    [tracking code goes here ]
    
    <?php };
    
     
    • Thanks Thanks x 1
  7. OriginalEXE

    OriginalEXE Power Member

    Joined:
    Feb 6, 2012
    Messages:
    634
    Likes Received:
    664
    Occupation:
    WordPress developer
    Home Page:
    True :)
     
  8. bobbylove321

    bobbylove321 BANNED BANNED

    Joined:
    Nov 8, 2008
    Messages:
    1,987
    Likes Received:
    2,198
    How would wordpress know which specific post is the thank you page if I put that code in the single.php?

    Wouldn't that make all the single posts have the code?
     
  9. OriginalEXE

    OriginalEXE Power Member

    Joined:
    Feb 6, 2012
    Messages:
    634
    Likes Received:
    664
    Occupation:
    WordPress developer
    Home Page:
    Where it says post-slug in the code, replace that with an actual post-slug of thank you page.
     
    • Thanks Thanks x 1
  10. bobbylove321

    bobbylove321 BANNED BANNED

    Joined:
    Nov 8, 2008
    Messages:
    1,987
    Likes Received:
    2,198
    Thanks for your help.

    But I found an easier way to do it.

    It was the theme I was using, so I had to go the html of the specific post, and paste the code, and not change it back to plain text.

    This worked.
     
  11. OriginalEXE

    OriginalEXE Power Member

    Joined:
    Feb 6, 2012
    Messages:
    634
    Likes Received:
    664
    Occupation:
    WordPress developer
    Home Page:
    Yeah, glad you fixed it. Kepp the code in mind when you will need php code inserting on single post ;)