Let’s say I have a landing page URL that is not on my own site, www.notmysite.example/somepage
and I want to advertise this link. I would like to create a URL that is tracked through my G4A Tag Manager, whereby the link click, referrer, etc., are all tracked in a G4A campaign.
I found this video that uses the older Universal Analytics and it’s looks like a convoluted solution.
Basically, I just want an intermediary link that tracks the click and redirects to the proper page.
Since I do have access to a WordPress site that has G4A tracking, I’m thinking of creating a redirect on that page that reads the URL parameters. However I’d rather not have to deal with another system and configure redirects this way.
How can I accomplish this with G4A and Google Tag Manager?
— UPDATE —
I’ll try to clarify. Given a link like a GoFundMe campaign link, GoFundMe has their own internal tracking and analytics. However, I can’t see how to add tracking to that link for my own personal use and/or see analytics on their site. Therefore, I want to create my own link that does the analytics tracking then forwards the user to the desired page.
2
Answers
In following the video I cited above, I was able to create an intermediary link capture but it does require a page on your website, where you can add a brief "loading" image or something.
This solution involves the following steps:
url-redirect_parameter
URL variable, where if the "redirect" query key is present, it will fireCreate a
redirect
CUSTOM JavaScript variable that reads theurl-redirect_parameter
variablefunction() { try { return {{url-redirect_parameter}}?setTimeout(function(){window.location='{{url-redirect_parameter}}'},500):false; } catch(e) { return e; } }
This custom JS variable references a redirect tag with the following configurations
redirect Trigger
trigger that to your GA tag on your websiteWhat this captures now is whenever there is a "redirect=" in the query string, the trigger will fire, record and redirect.
Another solution is just to add UTM parameters to a page you control on your site and have code on that page to auto-redirect to a QS parameter as well. This essentially does just that by injecting JS that does the redirect if the QS is present.
I hope his helps someone else looking for a similar solution and open to other solutions, like a G4A solution.
Here is the Universal Analytics result:
Not quite understand your situation and your goal based on your explation.
But assuming you have back-end access to where you’ll be adding the link you wanted to track, you can also track event using google data layer instead of redirects
All you have to do is listen to the click event of the button
e.g.
event and datalayer