And use it on my site for tracking user events as an alternative to Klaviyo JS library. (I do this for better page speed. In my case your js library does not download to the user browser.)
But I have an issue with tracking "Active on Site". I don't find a way to do this from server side.
1) Is there a possibility to track this on server side or I can do this only with your JS script?
2) Do you plan to add this option to the server side api?
3) Maybe you have a workaround for this now?
Best answer by cbarley
Hey @gtm-server , cool you’re developing a Server Side tag! I’ve been working though that tool for a bit to see how it works and it’s really interesting.
To answer your question, there are a couple ways to figure out how to spoof an Active On Site event through the Serverside API. The best way to tell is from the network tab in the Chrome Dev Tools, but there’s technically 2 ways to spoof it:
On any onsite event, include $is_session_activity=true. It gets picked up and used to generate/update an Active on Site event with a new url and timeframe.
To track it just by itself (ie to mimic a person just bouncing around on the page and not triggering other events) there’s a specific event name and structure. Here’s an example that I sent from my own account:
Referrer and last referrer are necessary though, those are just reserved profile properties that hydrate that “how they found you” section on a profile, which our cookie tracks by default
Let me know if you have follow up questions after testing!
Hey @gtm-server , cool you’re developing a Server Side tag! I’ve been working though that tool for a bit to see how it works and it’s really interesting.
To answer your question, there are a couple ways to figure out how to spoof an Active On Site event through the Serverside API. The best way to tell is from the network tab in the Chrome Dev Tools, but there’s technically 2 ways to spoof it:
On any onsite event, include $is_session_activity=true. It gets picked up and used to generate/update an Active on Site event with a new url and timeframe.
To track it just by itself (ie to mimic a person just bouncing around on the page and not triggering other events) there’s a specific event name and structure. Here’s an example that I sent from my own account:
Referrer and last referrer are necessary though, those are just reserved profile properties that hydrate that “how they found you” section on a profile, which our cookie tracks by default
Let me know if you have follow up questions after testing!
I don't have the ability to determine "browser" and "os" on the GTM Server Side, for now, so I don't send them. Also, I added the "X-Forwarded-For" header to this request and send the user IP there.
All works great, but I still have one small question) What do you think is this good idea to send page referer into "customer_properties.last_referrer"? Is this field for page refer or more like for user start page?
@gtm-server not sure how, but I’m just seeing this now! Looks awesome. I downloaded the template to my GTM environment and will test it out. Awesome to see this work going on. Nicely done :)
Our preference is as well to have everything server side but how does Klaviyo will track cross browser emails clicks. I see a fragment of code on the client side script from Klaviyo which basically parses the url to extract email from utm_email or get the klaviyo keys _ke /_kx and identify the user again.
Does Klaviyo still do similar identification on server side?
@gtm-server not sure how, but I’m just seeing this now! Looks awesome. I downloaded the template to my GTM environment and will test it out. Awesome to see this work going on. Nicely done :)
@cbarley Do you have any questions or suggestions?
Hey @Stape , If you want to use the _kx parameter in your requests (_ke is now deprecated), you can actually pass the raw value of the exchange_id that you can get in the console ( by running _learnq.push([“_getIdentifiers”]) ), and using that in a serverside request instead of $email. Example Track Payload:
By clicking “Accept All Cookies,” you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts.
Privacy Preference Center
Your Privacy
Strictly Necessary Cookies
Performance Cookies
Functional Cookies
Targeting Cookies
Site Analytics
Your Privacy
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
Privacy Notice
Strictly Necessary Cookies
Always Active
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
Performance Cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
Functional Cookies
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
Targeting Cookies
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.
Site Analytics
These cookies record your visit to our website, and are used to track your visit including information such as: web page interactions (clicks, hovers, focus, mouse movements, browsing, zooms and other interactions), referring web page/source through which you accessed the Sites, heatmaps and scrolls, screen resolution, ISP, and statistics associated with the interaction between device or browser and the Sites. If you are accessing our Services with a European IP address, you have been asked to consent to the use of these cookies (you are free to deny your consent).