I have a use case where I cannot use the usual method of collecting custom event data via Adobe Data Collection which is creating a rule then setting action as Adobe Analytics - Set Variables, then Send Beacon then Clear Variables. I need to tightly control what data is sent with the hit to Adobe. In Data Collection the rule fires. My main issue is with the Action in the rule, which is set to Custom Code. To control the data I want to send to AA, I'm using Javascript to set a few variables then send the data via s.tl() method. The issue is that when the call is sent it's sent as a page view. In the Experience Platform Debugger, isPageView is true on the hit. It should be false; it should be a s.tl() with the link type being "o" (custom link). This is the code. What needs to be changed to make it a non-pageview hit? Btw all the vars I'm setting and sending are fine and being collected, the only issue is the hit being a page view.
<script src="AppMeasurement.js"></script>
<script>
// Instantiate the Analytics tracking object with report suite ID
var s_account = "myreportsuiteid";
var s=s_gi(s_account);
// Make sure data is sent to the correct location
s.trackingServer = "my.trackingserver.com";
//Assign all vars we need to collect
s.pageName = page_name;
s.eVar1 = location.pathname.split("/").slice(-1)[0];
s.eVar2 = document.location.href;
s.events = "event32";
// Send hit to Adobe
s.tl();
</script>
Solved! Go to Solution.
Views
Replies
Total Likes
Your s.tl() syntax is wrong. You haven't specified any of the required parameters. E.g. in your post, you mentioned that you had set the "o" value, but then in your example code, you just use "s.tl()". See the documentation at https://experienceleague.adobe.com/docs/analytics/implementation/vars/functions/tl-method.html?lang=...
// wrong s.tl(); // correct s.tl(this, "o", "link name");
Furthermore, assuming that in your Adobe Analytics extension, you have selected the "Make tracker globally accessible" checkbox (in the Library Management section), then you should be able to call "s" directly in your custom code without needing to use s_gi(s_account), i.e.
// you can do this straightaway without needing to use s_gi() // if you have made the tracker globally accessible s.pageName = page_name; s.eVar1 = location.pathname.split("/").slice(-1)[0]; s.eVar2 = document.location.href; s.events = "event32";
Try the above and see if it works properly for you.
Your s.tl() syntax is wrong. You haven't specified any of the required parameters. E.g. in your post, you mentioned that you had set the "o" value, but then in your example code, you just use "s.tl()". See the documentation at https://experienceleague.adobe.com/docs/analytics/implementation/vars/functions/tl-method.html?lang=...
// wrong s.tl(); // correct s.tl(this, "o", "link name");
Furthermore, assuming that in your Adobe Analytics extension, you have selected the "Make tracker globally accessible" checkbox (in the Library Management section), then you should be able to call "s" directly in your custom code without needing to use s_gi(s_account), i.e.
// you can do this straightaway without needing to use s_gi() // if you have made the tracker globally accessible s.pageName = page_name; s.eVar1 = location.pathname.split("/").slice(-1)[0]; s.eVar2 = document.location.href; s.events = "event32";
Try the above and see if it works properly for you.
I made some changes and it works now. @yuhuisg , I added parameters to the s.tl() as suggested. Looks like this.
s.pageName = _satellite.getVar("Page Name");
s.eVar1 = _satellite.getVar("Page Name");
s.eVar2 = _satellite.getVar("Page URL");
s.events = "event32";
s.linkTrackVars="events,eVar1,eVar2";
s.linkTrackEvents="event32";
s.tl(this,"o","mylink");
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies