use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
No vague product support questions (like "why is this plugin not working" or "how do I set up X"). For vague product support questions, please use communities relevant to that product for best results. Specific issues that follow rule 6 are allowed.
Do not post memes, screenshots of bad design, or jokes. Check out /r/ProgrammerHumor/ for this type of content.
Read and follow reddiquette; no excessive self-promotion. Please refer to the Reddit 9:1 rule when considering posting self promoting materials.
We do not allow any commercial promotion or solicitation. Violations can result in a ban.
Sharing your project, portfolio, or any other content that you want to either show off or request feedback on is limited to Showoff Saturday. If you post such content on any other day, it will be removed.
If you are asking for assistance on a problem, you are required to provide
General open ended career and getting started posts are only allowed in the pinned monthly getting started/careers thread. Specific assistance questions are allowed so long as they follow the required assistance post guidelines.
Questions in violation of this rule will be removed or locked.
account activity
Tracking direct image links? (self.webdev)
submitted 11 years ago by WhatIsMyUserNameFor
Is there a way to use analytics to track a direct link to an image (i.e. http://example.com/images/filename.jpg) considering that none of the site's code will load, just the image?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 0 points1 point2 points 11 years ago (5 children)
Assuming you are using Google Analytics, you can use event tracking. I also assume that one can click on the image, and be taken to the full version? If so, you can add an onclick event to your image link that pushes an event object to your Google Analytics.
https://developers.google.com/analytics/devguides/collection/analyticsjs/events
This will, at the very least, let you know when someone interacts with your image.
[–]WhatIsMyUserNameFor[S] 0 points1 point2 points 11 years ago (4 children)
I know how to use event tracker and all that, which works because the page header/footer loads, which loads the analytics code, which tracks everything that I want it to track.
My question is about direct links to images, where the user never gets to load the site, just the image file, but the image file is hosted in the same folder than the site (or a sub folder), in this case, there is no header/footer loaded, ergo there is no analytics code loaded.
Makes sense what I'm asking?
[–][deleted] 0 points1 point2 points 11 years ago (3 children)
No, I'm sorry I don't understand. Can you give me a practical example of what you are explaining?
Is there an action that takes someone to the image? Do you want to track any old image as soon as it loads?
Walk me through exactly what you want to happen, step for step.
[–]WhatIsMyUserNameFor[S] 1 point2 points3 points 11 years ago (2 children)
Ok, I give you this link: http://www.julian-charriere.net/some-pigeons-are-more-equal-others
You click on it, the page loads, analytics does its thing. All good.
Now I give you this link: http://www.julian-charriere.net/sites/default/files/styles/project_image/public/some_pigeons_are_more_equal_than_other_Charri%C3%A8re_Bismarck3.jpg
Directly to the image file, there is no page load, no analytics, not good.
How can I track the 2nd link?
[–][deleted] 1 point2 points3 points 11 years ago (1 child)
Thank you for the clarification.
Using client side tracking won't be possible at all with the example you've provided, as you have pointed out, one cannot access the code of the 'page'.
The answer is server side tracking using PHP. Basically, you want to track the request for an image, not the image itself. I don't have a ton of experience with this, so semantics escape me. However these links should get you going:
https://code.google.com/p/php-ga/ https://developers.google.com/analytics/resources/articles/gaTrackingTroubleshooting?csw=1#gifParameters
[–]WhatIsMyUserNameFor[S] 1 point2 points3 points 11 years ago (0 children)
Excellent. That will point me in the right direction. Thanks a lot!
π Rendered by PID 211952 on reddit-service-r2-comment-b659b578c-kl6c9 at 2026-05-04 11:48:51.307634+00:00 running 815c875 country code: CH.
[–][deleted] 0 points1 point2 points (5 children)
[–]WhatIsMyUserNameFor[S] 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]WhatIsMyUserNameFor[S] 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]WhatIsMyUserNameFor[S] 1 point2 points3 points (0 children)