Custom Event Goal + Google Tag Manager
We do not have typical "goal" pages for events like Account Creation, Account Upgrade, etc. These all happen on the server side without the user being taken to a specific URL.
We're wondering if we can use Google Tag Manager's trigger feature to look for these events and then fire a custom HTML tag that contains the Optimizely snippet, plus the custom event goal snippet?
The custom tag looks like the following:
<script src="//cdn.optimizely.com/js/xxxxxxxxx.js"></script> <script> window['optimizely'] = window['optimizely'] || ; window.optimizely.push(["trackEvent", "accountCreated"]); </script>
Is there any particular reason why the snippet can't be installed normally, as opposed to inserted dynamically through GTM (if this certain condition is met from your side)?
And are you planning to make the visual changes on the page? Or as you simply just wanting to fire a custom event goal only?
It would be interesting to hear what you're trying to do with the experiment overall using Optimizely, and how it fits into your server side event data!
Dang this thread is old, but we are in a similar situation. We deal with one url and multiple virtual pageviews. The goal with this is that visual optimizely changes occur on the first virtual pageview, but the conversion (if so attributable to our visual changes), doesn't occur until several virtual pageviews later...
On the final virtual pageview, ( "/join/welcome" ), a conversion is considered to have occured. Currently GTM is setup so that:
1. A Trigger Fires when the virtual pageview occurs.
2. The Trigger Inserts a Custom HTML Tag that contains the optimizely.push(track event)
However, since implementing, we've had conversions occur, but none of them have been successfully counted/tracked/fired.
For anyone who has figured this out, I could really really use some advice - even if its to stop doing this way because its wrong or a dead end.
Thanks in advance!
PS: Not Afraid of Jquery or JS, feel free to throw code at meh!
Quick reply to this, I actually made this work. The key for me in this case was to NOT rely on Google Tag Manager Events (In my case,Virtual Pageviews) to make my custom optimizely event fire, BUT to use Google Tag Manager to insert JS that would listen for an attribute change on a specific element and then fire the optimizely tracking event!
The beauty of this is that it worked for a full-funnel conversion when my optimizely experiment was only targeted to the lander.
Preface: I used Tag Manager to insert the code because it takes a long time to commit code changes to our products, but for I change my tests fairly quicky and those changes do not necessarily align with dev production cycles.
So my setup:
1. Optimizely ONLY points to step 1 and makes changes (but I want to loop back full funnel conversions to my optimizely experiment)
2. On the final step, I use Tag Manager to fire the event using an attribute watcher (Attrchange JS):