• Resolved vebbmaster

    (@vebbmaster)


    Hi! I have an affiliate link that allows for one custom “source” field at the end, such as: https://www.example.com/?source=MyLandingpage

    This doesn’t help me track where my conversions are coming from originally (to my site), i.e. if they are from social media, AdWords, organic, etc.

    Is there a way (using JS/PHP?) to automatically and dynamically add, to the end of the URL, either:
    1. A unique user ID, or
    2. The referral domain/type?
    3. Any such identifier from Google Analytics

    So my url would be like https://www.example.com/?source=facebook for example.

Viewing 4 replies - 1 through 4 (of 4 total)
  • This plugin may do what you are looking for https://www.ads-software.com/plugins/affiliatewp-affiliate-info/

    Thread Starter vebbmaster

    (@vebbmaster)

    Hi, thanks for your reply! Unfortunately, that is not what I’m looking for – rather the reverse.

    I can see (in Google Analytics) where people come from and which button/link they click to leave. I can see (in my affiliate program’s backend) how many conversions I get from those clicks.

    What I cannot see is where those conversions originally came from. I want to know if visitors from a particular source convert better, so I can keep optimizing my efforts.

    If there was a way to automatically append the exit url (on my site) with the referral domain, then I would also see it in the affiliate backend. It must be possible somehow!

    Thread Starter vebbmaster

    (@vebbmaster)

    Tim Felmingham seems to have the answer I was looking for!

    https://timfelmingham.com/adwords-conversion-tracking-affilates/

    I use (a variant of) this code:

    <?php
    $gclid=$_GET['gclid'];
    $outgoinglink = 'https://www.merchants_website.com/mylandingpage.html?affID=12345&subid='. $gclid;
    ?>

    Then add gclid=whatever to my inbound links (from Facebook, etc.). Works perfectly on “naked” links. Because I use redirects for all outbound links, it’s not as easy as it should be, but I will figure that part out!

    Thread Starter vebbmaster

    (@vebbmaster)

    I figured I’d give an update on this, because I did figure it out in the end. The answer was a simple PHP cookie. Something like this:

    <?php
    setcookie("source",$_GET['utm_source'],time()+60*60*24*30, '/');
    ?>

    Then you can access what is stored in the cookie in many ways, for example:

    echo $_COOKIE["source"];

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Appending URL with unique ID’ is closed to new replies.