Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I've researched but not found a solution for this situation, please advise!

I want to track where exactly click come from a youtube video.

What I have tried:

A PHP file named "trackid.php" with following code:

PHP
$actual_link = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : '';
echo $actual_link;


I shortened URL of that file using goo.gl, and place that shortened URL in the description of a Youtube video.

When I try to open the shortened URL, the result is

https://www.youtube.com/


But I need to get full URL including "watch?v=sampleID", I want to get ID of the video for tracking purpose.

Please advise!
Posted
Updated 28-Jan-18 4:07am
v2
Comments
Mohibur Rashid 28-Jan-18 16:50pm    
What does your
print_r($_SERVER);
Shows?

1 solution

You cannot because it come from https and so there is only the domain transmited and not the full url.
 
Share this answer
 
v2
Comments
OriginalGriff 30-Jan-18 10:13am    
Please don't repost if your messagedoes not appear immediately: all of these went to moderation and required a human being to review them for publication. In order to prevent you being kicked off as a spammer, both had to be accepted, and then I have to clean up the spare. Have a little patience, please!
luplup 30-Jan-18 10:28am    
Sorry Griff, i have repost because my post disappear after trying editing it for a typo... and im just discovering this "Quick answers" section.
OriginalGriff 30-Jan-18 10:37am    
It disappeared because it went to moderation - there is an automatic anti-spam system and you came to it's attention! :laugh:
It's not allowed to delete things - that's reserved for humans, but we moderators are pretty quick at checking these things out and getting them back in place. I know it's a pain, but you wouldn't *believe* how much cr@p a single spambot can generate when they get going, so it's definitely necessary.
Things don't (generally) just disappear round here, so have a little patience, please.

Welcome to QA: please make yourself comfortable and remember that some questioners are only interested in getting their homework done for them so they may be "unfriendly" if what you reply is not something they can hand in. Ignore them, or report abuse here:
https://www.codeproject.com/Forums/1652005/Spam-and-Abuse-Watch.aspx
luplup 30-Jan-18 12:34pm    
Sorry for the other place too :)
I have answer too quick :D
And it's not because of no patience...
Thanks for the welcome ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900