I am trying to figure out how to add tracking with Google Analytics to multiple phone numbers on a Wordpress site. I saw this page from and earlier Stack Overflow post but I wasn't sure if it was up to date. I noticed somewhere else (here) on a Google search that said you have to add an Event in your GA account first and then add that code. Is this correct? Or do you just have to add the code itself to the Wordpress site without adding an Event in GA?
Also, if it's code for a link, can I highlight the phone number and put the code into the link area (as in chain link in the Visual Editor) on the page, or do I have to place this code in the Text Editor part of the page?
I'm using the current UA right now.
Also, I'm really new to this event tracking stuff, so please accept my apologies if I stated/asked anything incorrectly. Thanks in advance for any and all feedback.
Add a class to all your phone number instances within your HTML. ie class="tel">
Write a click function on that class, and then push the ga following the correct version syntax.
ga('send', 'event', 'category', 'action');
So:
$('.tel').click(function() {
ga('send', 'event', 'Category1', 'Action1', 'Demo!');
});
Use Google Tag Manager. It's great tool. There is also a plugin: DuracellTomi's Google Tag Manager for WordPress. You must read some documentation about GTM but when you will know GTM you can track almost anything on your site.
Related
I've researched several sources to try and understand how to set up this up, but the documents found seem incorrect our out of date. I'm trying to achieve the following.
When someone submits on my 'contact us' form, I'd like to track that as a conversion in AdWords.
I've completed the following:
- Set up the Conversion in AdWords
- Added the Google Tag Manager code to Squarespace and validated it works
I'm struggling to understand what needs to happen next, I believe it is something like:
- Create a GTM AdWords tag and add in AdWords Conversion ID and Conversion Label
Set the trigger as a form submission
Do I then need to add some form of code into Squarespace on the contact us page to pick up the trigger? this is the part I'm stuck on.
Any guides that explain this in full would be great.
I am using Universal Analytics and have added the following code under the "Additional Settings" tab as suggested by dozens of articles including the one suggested by Contact Form 7's website:
on_sent_ok: "ga('send', 'event', 'Contact Form', 'submit', 'success');"
My Category, Action, and Labels all match set up in Goals. I have been testing this for hours and using various other methods on a different website but still no joy. I am not using any SEO or Yoast Plugins, and I have the Universal Tracking JS code installed.
Yet it's still not tracking. I can see it under Real Time Conversions, but it doesn't appear in Real Time Events nor Conversion Goals. What the heck could I be doing wrong?
After trying every code on the internets, I figured out how to simply set it up using Tag Manager! Obviously you have to have a GTM Account and paste the Tag Code on your website. Here's how to set it up:
Set up a New Trigger called "Form Trigger"
Choose "Custom Event"
Fire On, copy and paste this: gtm.formSubmit
Create Trigger
THEN ---
Set up a New Tag called "Form Submission"
Choose Product: Google Analytics
Choose a Tag Type: Universal Analytics
Enter Analytics Tracking ID
Track Type: Event
Category: Contact Form (or whatever, this will match the category name you set up in Goals in Analytics)
Action: Submit (or whatever, this will match the action you set up in Goals in Analytics)
You can add a Label and Value if you want, just make sure they match when setting up goals in Analytics. I just left them blank in both cases.
Fire On: click "More" and select the "Form Trigger" trigger you previously created.
Save Tag
Then just set up your Goals in your Analytics and test your form. In Reporting, I clicked on Real Time >> Events, filled out the form and BAM! I saw it right away and it recorded in Conversions instantly!
This was THEE only way I could get it to work. Works with sites with or without Yoast or whatever other SEO plugins. I hope someone finds this helpful, I tried EVERYTHING and this was the only way I could get it to work.
Cheers!
For marketing purposes, if a link to our company website is posted on a page on an external website. Is it possible to track the time in which the user landed on the external website and clicked on the link to our company website, using custom tracking ?
I have been reading about custom GA tags however am having a hard time understanding how to make the above possible.
Thanks in advance!
You cannot track an external website, as you can only track sites where you control the tracking code.
If you have control over the external site and have implemented analytics tracking there you would
create a timestamp on page load
add an onclick event handler to the link to your site
in the callback function for that link create another timestamp, substract the original timestamp to get a duration
send a user timing call:
ga('send', 'timing', 'Link', 'Duration to click', duration);
Where the "duration" parameter would be replaced with your timestamp.
As I've said that would only work if you can run your own Google Analytics on the external site which does not seems very likely. Plus I have really no idea what you mean by "custom GA tags" (there are custom variables and custom dimensions/metrics, both of which will not help you here).
So basically the anwser is you can't, really.
I've searched high and low for an answer for this problem and need the help of experts.
The website I'm helping to oversee has a registration in a frame on their main website. When a user visits the site, they can choose which course to take and click on a "Register" link to be taken to the externally hosted form.
I was able to get the GA tags changed on the framed pages, so that step is done.
However, I realise that in order to properly cross-domain track with Google Analytics, I need to also add an onclick event to any links that bring users to those pages, such as the example below.
Link
However, the site I'm working with is in Wordpress, and when I view the link in there it looks like this:
[iab_event link="http://www.EXAMPLESITE.com/course/4105/register.asp" text="Register"]
And when you view the page source of the live site this link is translated to this:
Register
I tried adding the second onclick event to the one above, but that didn't work. Is there any way to add the onClick="pageTracker._link('http://www.EXAMPLESITE.com/course/4105/register.asp'); return false;" to this link without breaking it?
Thank you in advance for any advice given!
Try stacking them in the onclick event like this:
Register
It should run all of the commands as long as they're separated by semi-colons.
I have a page in ASP.NET C#, In my page I have iframe with another page. I want to add a Goal in Google analytics when people press the Submit-linkbutton in the framed page.
While my url doesnt change when I press the submit button I have heard that you can use the following javascript to tell Analytics that you´re on the specified page:
pageTracker._trackPageview('/booking.html');
So I have added the following line in the page_load function:
SubmitButton.Attributes.Add("onclick", "pageTracker._trackPageview('/booking.html');");
And in Google analytics have I added the goal url:
/booking.html
But nothing happends in the goal section when I press the submit button.
Im really not sure of what im doing so some help had been really appreciated.
Martin
Since iframes are treated as completely separate pages, I suspect you need to add the tracking code to the framed content as well.
You might also try calling a function in the parent page which triggers the page tracker:
SubmitButton.Attributes.Add("onclick", "parent.TrackPageView(window.location.href)");