Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8859615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:06:38+00:00 2026-06-14T15:06:38+00:00

I need to track a dynamic button that redirects to another url. I need

  • 0

I need to track a dynamic button that redirects to another url. I need to track everytime this happens and know exactly to what url the user is beeing redirected.

The button code:

 <a target="_blank" href="/out.php?url=<?php echo urlencode($this->product['from'])?>">
 <img src="http://xxx.com/data/images/buy.jpg" alt="buy"/>
 </a>

File “out.php”

 <?php
 $url = urldecode($_GET['url']);
  header("Location: ".$url);
  exit;?>

I want that for example if a user clicks on buy, it redirects to “out.php” and shows a message like “U are beeing redirected in a few seconds” and then sends to the url.

I need this in order to track via analytics how many times the user landed on that page and where they came from, getting some metrics about outbound clicks.

Anyone knows how to do it?

Thanks in advance!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:06:39+00:00Added an answer on June 14, 2026 at 3:06 pm

    If you are using event tracker to determine which link was clicked, you can filter all the links you want to track and add an event call to the links:

    var links = document.getElementsByTagName("a");
    
    for(var i=0,l=links.length;i<l;i++){
       if (filter your links to only the external ones){
             links[i].onclick = function(){
                 _gaq.push([your track event code here]);
             }
       }
    }
    

    Since your links have target=”_blank”; there is no need to add a delay so the gaq call is complete. If they don’t open in a new window here is what you can do:

    links[i].onclick = function(){
        _gaq.push([your track event code here]);
        var url = this.href;
        setTimeout(function () {
            window.location.href = url;
        },500); // redirect in 500 milliseconds
    
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to track a dynamic button that sends the user to another url,
I need to track purchases on my site via a dynamic button that redirects
I need to track every time a user clicks on a dynamic button. Also
For my application I need to keep track of all files that are touched
I need to track href links in a dynamic textField. ie the text is
I need to track which instance created another instance. It's an instancing hierarchy not
I need to keep track of different dates (dynamic). So for a specific Task
Since I'm building a dynamic site, I need to track the changes between pages,
I need to Track Unique Visitor count in my web application. I would really
I need to track outbound clicks from a directory on our site, and would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.