Can I track changes to a web form using webtrends? - javascript

Does anyone know of a way to track changes to a web form, i.e. select or text field using webtrends?
I know Google Analytics has similar functionality, can this be done in WebTrends?

Webtrends has Javascript click tracking so you'd have to add Javascript onChange or onClick events to whatever you need to track.
Since web forms don't typically trigger the Webtrends link tracking, you have to use the dcsMultiTrack function, passing the variables that need to be tracked.
For example, you might use the following to track the URL that you're on and the fact that a particular field was clicked:
onClick="onclick="dcsMultiTrack('DCS.dcssip','www.domain.com','DCS.dcsuri','/yourpage', 'WT.ti','formfield1','WT.dl','1');"
Note that the WT.dl parameter should be set so you don't count extra page views. Also note that the WT.ti parameter is used for automatically tracking this as a link click. If you need more granularity, you can always define another variable (for example, "formname) and configure Webtrends to report on that as another dimension.

Related

Is it possible to resize the temp event added with selectMirror in FullCalendar v5.7.2?

I managed to get a temporary event making use of selectMirror in FullCalendar v5.7.2.
I was wondering if there is a way to dynamically resize this event based on user preference. I tried to access the last element of the calendar.getEvents() but this returned an already validated event.
Any feedback would be very useful for this. Thanks!
I managed to get a temporary event
...it's not really a temporary event, it's just showing you the currently selected area in a more emphatic way than the default display. (The documentation calls it a "placeholder event" but that's a bit of a misnomer really compared to its actual functionality.) Therefore none of the event-related functions are any use to you here.
The easiest way to resize it is simply for the user to go back and drag again to select a different area. However if you want to do it programmatically based on some other input from the user (e.g. via a separate datepicker control, or something like that) then you can use the select() function to change the current selection, e.g.
calendar.select(start, end)
where start and end are valid Date objects or date-parseable strings.
More info: https://fullcalendar.io/docs/Calendar-select

Reliable way of knowing when BigCommerce checkout form has loaded

I'm trying to listen for when the form is loaded on the BigCommerce checkout page.
We need to add address validation to the page (+ disable all except first address field so it's auto populated by the address validation service we're using).
The address validation service's JavaScript is firing before the form elements exist because the BigCommerce checkout page works by dynamically adding HTML to the page with JavaScript links which then load the form.
I was thinking of using one of
Polling, setTimeout repeatedly at say 200 millis until some known element exist
Using MutationObserver which seems to do what I want https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver - I can control the div inside which the form is loaded so use mutation ovbserver to listen for "subtree" events but reading the MDN docs it was clear what subtree really means and/or when it fires
Any suggestions?
If you are on Optimized One Page Checkout, you will definitely want to go with the Mutation Listener.
This Blog Post by the BC team includes some really handy Mutation Listener code that I've leveraged on multiple checkout customizations:
https://medium.com/bigcommerce-developer-blog/the-complete-guide-to-checkout-customization-on-bigcommerce-6b566bc36fa9
Word of warning - the OPC checkout is an external application - not included in the base Cornerstone Repo source code at all. I believe it's a React App. If you are familiar with how React and other frameworks handle conditional rendering, they will often un-mount and re-mount components/HTML elements in response to their internal state.
For example, when you move from the "Shipping Details" step to the "Billing Details" step on checkout, the shipping details DOM nodes are completely un-mounted from the page.
This means that anything you've attached to them via JS/JQuery, such as event listeners, will be gone. You'll need to configure the mutation listener to listen for mounting of every single section that you need to do work on, not just the entire checkout app. This makes checkout customizations fairly tricky to handle.
Another issue - if you want to over-write the input field values, you're going to be fighting with the React app, once again. As I've mentioned, React contains an internal state which controls the values of the address inputs. You can try to use JS to change the value of those inputs, but the internal state within the React app corresponding to those fields will not update. You will need to either use the checkout storefrontAPI to update those values,or you will need to use a hacky solution to manually trigger React's internal synthetic event emitter after updating the values with your JS code, I've used this library to some success:
It's not an ideal solution at all.
https://github.com/vitalyq/react-trigger-change
Preferably, if you need tight control over checkout, you can develop a customized checkout solution using the checkout-sdk that BC provides, but this is not a light task, as it's more a set of building blocks for building custom checkout flows rather than something you can drop in and start customizing right away.

Google Analytics Event Unique Per Session

I have a site where I track click outs, one user may click out several times so if I have 100 users I may have 300 click out events. This is ok for a rough guide but ideally I would like to know how many users have clicked out so 100 users 85 users clicked out.
I could write some js on my site to handle this store in a cookie but I was wondering if there is anything in ga.js that will allow me to fire an event once per session.
You can use Custom Dimensions to scope things to the session (or even the user). Create a dimension in the Google Analytics admin tab under Property within Custom Definitions.
Set the scope to session, then copy the ga('set', 'dimension1', 'Description Here'); and paste it before sending the event (obviously, change "Description Here" to your own explanation. Also, make sure 'dimension1' matches the index it gives you.
Custom dimensions (and metrics) are tied to hit types, so simply setting them does nothing until a hit type is sent- so either a pageview or an event.
Once you've created the dimension, you can use it for anything you would a standard dimension in reporting- including segments and custom reports.
Hope that helps!

How to differentiate manual save and programmatic save in CRM 2011 JScript

I have a Javascript code registered onSave of record. I need to check whether the save operation is happening by clicking on Save button or saving programmatically like Xrm.Page.data.entity.save().
Do we have a JScript code to get the source control of the event, means event generator?
Without this information on the context why not set a variable in the JavaScript function where you call entity.save explicitly? You can then check this from any other JavaScript function to determine "context". It's a bit of a hacky global flag but it'll do the job.
If you need to get a hold of this "context" within a plugin you can create a hidden attribute on the form setting submitMode('always') that you set prior to save within the custom JavaScript and reset on load.
Have you tried something like that: https://community.dynamics.com/product/crm/f/117/t/58773.aspx

Hashchange not firing when user clicks on same link

I'm creating an HTML and Javascript client for running in browser which talks to REST API. I'm using RouteMap to set my URLs. So I've kept a convention something like this
http://mysite.com/#/{ResourceName}/[edit|view|list]/[Id]/
I've set just one route and I'm grabbing these parameters in the function bounded to hashchange. Most of the things work fine. Just two issues and I'm stuck because of them.
If the user clicks on the same link twice, hashchange event doesn't fire. Yes, hash has not changed so obviously it won't fire. But there should be something which can be done and I'm missing that.
If I change something in the UI (like bring up new divs and hide some) for which I don't want to change the hash link, I loose that history and can't go back by clicking the back button properly.
Any help will be grateful.
For #1, you probably want to attach a handler to the link click event. That way you can tell if the link is being clicked. When I use onhashchange, I always attach something to the click event to assist polyfills for onhashchange, so at least I can tell when it's failing.
For #2, I want to point out that having automatic stuff change the user's history is problematic. You could fill someone's history with minute, meaningless hash changes. I recommend only changing the history when the user actually interacts. Short of that, HTML5 does offer pushState and popState. Reference

Categories

Resources