Capturing URL from Form Submission Tracking - Google Analytics - forms

I'm looking to record the URL from which a form submission was sent from with Google Analytics.
Example:
Imagine domain.com. On domain.com Google Analytics (ga.js) is installed in the header.php and is on every page of the site. Similarly, in domain.com's footer.php there's the same contact form generated on every single page of the site.
Now, User 1 goes to domain.com. User 1 navigates to domain.com/page-c.html. User 1 submits a form from the footer contact form on page-c.html.
I want to know that a form was submitted from page-c.html. Or if User 2 submits from page-u.html then I know that a form was sent from page-u.html. It is not important that I know that it is User 1 or User 2. I just want to know the URL from which the form was sent.
Anyone know how to do this with Google Analytics? -- If not, maybe another analytics service?

You can use Google Tag Manager. Which can not only implement all the standard analytics capabilities but also lets you add event triggers with built-in variables. For example you'd enable the Page URL variable in GTM and add a Analytics Tag of type Event with Event Category, Action, Label being things like Contact Form, Submit, {{Page URL}} respectively. Then create a new trigger (triggers tell when to fire a tag). This trigger should be enabled always (i.e. something like PagePath contains / and be of type Form Submission. You can target it even better by saying trigger when to be when the Form ID is equal to the ID attribute of your contact form. This way you prevent conflicts with other forms triggering your event tag.
You can read extensively on Google Tag Manager here. It is a great tool to fine tune analytics and get more out of it.

Related

Using spfx webparts, would there be a way to either programmatically send an email which has a link to open a modal or using flow?

I want an spfx made webpart that I've made be able to send an email (I'm using IEmailProperties at the moment) which provides a link to a modal form?
For example:
User clicks button in webpart, form loads.
User fills out form and submits it to SP list.
Form sends email on submission. Email has a link to the actual item created, so when the user clicks the provided email link, it opens up the modal form.
I would presume that the user would HAVE to be sent to the SP page where the webpart is unconditionally, but would it be possible to open up the modal corresponding to the SP list item?
Is this feature available in SharePoint framework, because if it isn't, compared to something like InfoPath 2013 or PowerApps it's quite a limitation.
I've researched this with several shallow Google searches and on gitHub for any premade stuff, but alas there is nothing that I've spotted.
I've been told IT IS possible:
"Yeah, they’d have to visit the page. Email clients don’t do JavaScript so you can’t really do interactive stuff there. If you want to take them directly to a page that then displays a modal, that’s plenty possible though. (e.g. display the modal based on if the URL contains a certain string)"
But wouldn't know how to do the above, can anyone start me on the right path?
Regards,
T
In the email, pass a query string containing the item ID/list ID etc of the item, then have the webpart read the See: How can I get query string values in JavaScript? If your values exist. If they do exist, then open the modal using some kind of framework like bootstrap or fluent UI. You can write your own form using PnPjs or use an iframe potentially to display the OOTB edit form.
Additionally, you can link to any page in SharePoint provided you use an extension instead of a webpart to host the modal. You can install extensions tenant wide, and have it listen for the query string.

Use facebook tracking pixel for registration success that does not redirect to success page

How do I set a facebook pixel event to track registration completion when my registration form completion redirects to my index page not to a registration success page?
Should I use a standard event or a custom event to achieve this, or, do I have to create an intermediate page that the registration form directs to and then redirects to index page?
Fire the Facebook Pixel event when the user clicks on the form submit with 'click' event listener. Standard versus Custom events is a separate issue, but I suggest sticking with Standard events where you can.
https://developers.facebook.com/docs/facebook-pixel/advanced/
Stephen, you provided too few information.
Richy is right that in your case if you can't control where your user lands after submitting the form you should use onClick event to send a pixel event. You can easily validate the form in the code of the onClick event and send it when you're sure data is according to your expectations. You can even do additional requests to your back-end to check the data.
If you can change how your web-site work you can make a landing page where you'd fire an event if all the processing went right.
If you can also easily do it on your index page by loading it with some parameter in the URL that indicates it is visited after the form was submitted. There you can have a simple JS code snipped with condition in it to fire a pixel event if URL parameter is present or do it with Google Tag manager which is even simpler.
There are a couple of good standard events you can use like Subscribe or Submit Application, review them here: https://developers.facebook.com/docs/facebook-pixel/reference#standard-events
You have countless options depending on what level of changes you can do to the site, you coding skills, CMS you use and precision you need.

Google Tag Manager not firing the tag when the Data Layer variable is being pushed

in my website there is a form that allows the users to submit their email. When the user clicks submit, the email is pushed to the Data Layer. I have tested this by checking the data layer values using console:
email: "abc#gmail.com"
I have also set a Google Tag Manager variable called email, and I have created a trigger as shown below:
Now I set my tag to fire when this trigger is true. But my tag does not fire. I don't understand why. Can someone please explain why this may not be working?
This was not working because my website is a single page app and that's why Custom Event Triggers need to be replaced by History Change Triggers

Append Form text field value alone in the url

I am trying to create a sample Online shopping application using SPRING+REST. I have a 1000 of products and I would like to make use of #RequestMapping("watches/{id}") annotation . But i dont know how to send the id form field value alone while submitting a form in jsp.
I want something like this
www.example.com/watches/1001
Please help me out
I guess you will have some jsp page which consists of all watches. This web page can be access by localhost:8080/watches URL.
If user click on any watches, user will land to localhost:8080/watches/{watch-id} page as the click on watch will redirect the request.
If your JSP is form based page, then user need to enter the watch-id ( or watch name which we need to map to watch id) and click on submit button will redirect the request to localhost:8080/watches/{watch-id}. Please let me know if you are ok with this.

Zend Framework: How to POST data to some external page (e.g. external payment gate) without using form?

I would like to have a user redirected to an external credit card gate. Of course I have to POST some user info to that gate, but I don't know how exactly can I do this.
I know that I could do this by generating a html form with hidden or read-only fields and have a user click "Submit" button. But this solution is not perfect, because all the form data could be easily changed using e.g. Firebug. I think you cannot do this using $this->_redirect(...). But maybe there is some other solution?
Many thanks for any tips or suggestions.
I would like to have a user redirected to an external credit card gate. Of course I have to POST some user info to that gate, but I don't know how exactly can I do this.
Using a form is the only method available. The RFC states that the user should explicitly agree to sending a POST (i.e. click on a submit button).
I know that I could do this by generating a html form with hidden or read-only fields and have a user click "Submit" button. But this solution is not perfect, because all the form data could be easily changed using e.g.
It is no more secure that using a redirect as the header data can be modified without too much of a problem. There are even Firefox plugins to do it.
use cURL to post data
http://framework.zend.com/manual/en/zend.http.client.adapters.html