I have a requirement where I need to track the event of mostly downloaded pdfs/zip file from AEM. So for that I was thinking about two ways -
1) Use Adobe analytics and track the download event. After I will write a component in AEM to query Adobe analytic to give the result. But I could not find document on how to query analytics data from Adobe AEM.
2) Use tracker.js. But when I hit this url then this url host:port/libs/wcm/stats/tracker.js?path=/content/dam/geometrixx/documents/GeoCube_Datasheet.pdf then it says "impression added" but there is no way to see impression in console. Where I can see the impression? Is tracker.js only for page tracking?
For the Google Analytics I would go with an event trigger (or a virtual pageview if you prefer that). see https://support.google.com/analytics/answer/1136922?hl=en-GB
in both cases you will be able to track it (and see it happening in the debug console).
Related
I am trying to use Google Tag Manager to collect event data (including page view) but it isn't feeding through to Google Analytics once its deployed to Vercel.
I have checked the following things:
GTM has a GA4 Configuration Tag with the measurement ID from GA
I have set up the GTM measurement ID as a public variable in env.local (and reflected this in Vercel)
T have added the script to _app.js
I have added the iframe to _document.js
Set up the tags required in GTM and published it
Using dev tools I have checked that the gtm script (with the correct reference) is fired in the Network tab
Also checked dataLayer in the Console tab is collecting the data expected
However, in spite of all of this I can't see any data in Google Analytics. Played around a bit yesterday expecting to see some today but nothing.
It seems to work on localhost and checking both in real time Vercel doesn't register a view but localhost does.
Previewing the Vercel URL from GTM does say its connected and I can view that in real time in GA when going this way, but if I go to the address directly it's not logging it. Checking 'Tag Coverage' on GTM also says the pages aren't connected.
Am I missing something? It seems to work in theory, just not in practice when visiting the Vercel address directly (as opposed to via GTM preview)?
Thank you in advance
I think I found an answer myself and it's rather basic. It seems a pop up blocker I had installed ('Pop up blocker for Chrome™ - Poper Blocker') was preventing it from firing. Disabling the extension seems to have done the job.
How can I track that someone visited the following URL of my website http://www.website.com/mypdf.pdf.
I tried using a Page View trigger on a Page View tag. I'm completely new at Google Analytics so not sure how to proceed. Most people are going to be going to that pdf directly via URL, as there is no link to it on my website, but I really want to be able to track how many people view it.
Thanks in advance!
You cannot track PDF views with the help of GTM. GTM for web is a javascript injector, and one cannot inject Javascript into a PDF document from the browser.
One way to circumvent this is to have a gateway page, i.e. have the click go to a HTML page that counts the view before redirecting to the document in question (naturally you could use GTM in that page). Since people go directly to the PDF URL this would require a bit of scripting - you would have to redirect all PDF links to your gateway page via a server directive, count the view and then have the page load the respective document.
Another even more roundabout way would be to parse your server log files and send PDF requests to GA via the measurement protocol (actually many servers allow to have log writes redirected to another script, so you could do this in realtime). I would not really recommend that approach - it's technologically interesting, but probably more effort than it is worth.
The short version is, if you are not comfortable fiddling a little with your server setup you will probably not be able to track pdf views. GTM does not work on PDF files.
Facing same issue…
My solution was to use url shortener (like bitly.com) which includes opening statistics.
Not the perfect solution but it works for direct pdf access from external source (outside your site).
My client created a website and a google analytics account. The report indicates that the account is receiving data -- and yet, when we do a view-source of the pages of the site, there is definitely absolutely no analytics code there. How is this posssible?
It is possible that the Analytics code is added via Javascript, not appearing in the "View Source" page. It is also possible for it not to appear in the inspector either.
I do not know how this happens, but I have encountered scripts that exist and run although they are not displayed in either the source page or the live DOM inspector (in Google Chrome). This happened to me while loading a PHP template containing Javascript through an Ajax request.
If you have access to the source code of your website, search the entire project for for the Analytics ID (Here's how to find it: https://support.google.com/analytics/answer/1032385?hl=en), and you'll locate your tracking code.
If your project is running on a Linux server, here's a post about how to quickly find a keyword (like the Analytics ID) in a folder: How do I find all files containing specific text on Linux?
If I wanted to build a scraper that pings each URL on a site and stores the adobe (or Google) image request, how would I go about this? I.e. I just want something that grabs all the parameters in the URL posted to Adobe in a csv or something similar. I'm familiar with how to build simple web scrapers, but how do I grab the URL I see in for example Fiddler that contains all the variables being sent to the Analytics solution?
If I could do this I could run a script that lists all URLs with the corresponding tracking events that are being fired and it would make QAing much more manageable.
You should be able to query the DOM for the image object created by the tag request. I am more familiar with the IBM Digital Analytics (Coremetrics) platform and you can find the tag requests using accessing the following array document.cmTagCtl.cTI in the Web Console on a Coremetrics tagged page. I used this method when building a Selenium WebDriver test case and wanted to test for the analytics tags.
I don't have the equivalent for Adobe or GA at the moment since it depends in the library implementation am trying the do the same as you for GA.
Cheers,
Jamie
I have an html file that gets loaded when a user connects a flash drive to their PC. That HTML contains a direct link to a PDF on our server. (They don't want to put the PDF on the drive for some reason) Anyway, I'm trying to figure out how to track how many times this PDF is accessed from one of these drives.
Since the user is being taken directly to the file and not a landing page, is there a way I can attach analytics to the link that directs the user to the file? I was thinking a Virtual Page View would work but I don't understand exactly how GA would be getting that data.
Can anyone help demystify this?
GA needs to run javascript. PDFs will not invoke a call to GA when hit directly from search results, emails, or flash drives.
You might be able to track it by creating a rewrite rule on your server to a page that runs the GA code then loads the PDF on that page.
I had a similar feature on my site and it worked well except that while tracking the PDFs, the page that loaded the PDF was inflating my pageviews numbers. I didn't want PDF's to be mixed in with pageviews because it confused the client who had been used to separating the two. I created a filter for the PDF 'calling' page and the pageview number settled back down.
I ended up removing this method and falling back to the server logs for PDF downloads and GA for everything else.
GA is a javascript tracker. Plain and simple.
The issue is not the JavaScript, since you can include that locally, but the fact that GA won't work on HTML loaded from a filesystem.
The landing page can be built so that it automatically triggers the download and GA while that happens. Pageviews won't be an issue, since downloads should be tracked as events anyway.
You can attach a javascript function to the link and have it track the page view with Google Analytics
Check this out for more.
It's an easy way to track any file download on a website.