Can you do google ad conversion tracking in Universal Analytics? - events

I set up conversion tracking on the Google ads dashboard and it gave me snippets to use on my app. The snippets are all for GA4.
On the app I need to support both GA4 and Universal Analytics. I fire events to both properties. But I can't find anywhere online examples of how fire ad conversion tracking events in UA, it's all in GA4.
Is there a UA equivalent of this GA4 code?:
gtag('event', 'conversion', {
'send_to': 'Some/Id',
'transaction_id': '',
'event_callback': callback
});
Or can google ad conversions only be tracked in GA4?

G-Tag can be used for both Google ADs as well as Analytics reporting
ASwell as with ANalytics you first need to initialize G-Tag and configure it:
<!-- Global site tag (gtag.js) - Google Ads: CONVERSION_ID -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-CONVERSION_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config','AW-CONVERSION_ID');
</script>
Then send the Conversion Data.
<script>
gtag('event', 'conversion', {'send_to': 'AW-CONVERSION_ID/CONVERSION_LABEL',
'value': 1.0,
'currency': 'USD'
});
</script>
The Conversion ID and LAbel can be retrieved from the Google Ads Interface when selecting manual Implementation.

Related

Google Calendar API, Fullcalendar and private events

So I have integrated Fullcalendar on my site, which works fine. I have also integrated it to have events from my Google Calendar. This works when the calendar is set to public for everyone, which is not a desirable option. I know there is a way to share the events with the secret key, but I don't get it to work with the calendar.
Here is the render script of the calendar:
<script>
$(document).ready(() => {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,listYear'
},
displayEventTime: false, // don't show the time column in list view
// THIS KEY WON'T WORK IN PRODUCTION!!!
// To make your own Google API key, follow the directions here:
// http://fullcalendar.io/docs/google_calendar/
googleCalendarApiKey: 'API_KEY_HERE',
events: 'CALENDAR_ID_HERE#group.calendar.google.com',
eventClick: function(arg) {
// opens events in a popup window
window.open(arg.event.url, 'google-calendar-event', 'width=700,height=600');
arg.jsEvent.preventDefault() // don't navigate in main tab
},
loading: function(bool) {
document.getElementById('loading').style.display =
bool ? 'block' : 'none';
}
});
calendar.render();
});
</script>
Google Calendar secret is in this format.
https://calendar.google.com/calendar/ical/CALENDAR_ID_HERE%40group.calendar.google.com/private-PRIVATE_KEY_HERE/basic.ics
Is there way to format this address in the script so I could show events that are not publically shared?
Api keys are used to access public data, they do not work with private data. An api key should also only be giving you read access you will not be able to write to that calendar. So no there is no way to use an api key with a privately own google calendar.
You have two options the first being using Oauth2 and requesting authorization of the owner of the calendar. This will give you an access token which will allow for read and write access to the users calendar.
The second option would be to use a service account, this will only work with google workspace and will require that the admin of your workspace account configure domain wide dedication to the service account granting it access to preform actions on behalf of the workspace user who owns the calendar. This will again give you read write access on the calendar.

How to disable scrollify.js on mobile and get back normal scrolling?

I am creating a website on Webflow, and I have no experience in codes. I added a basic setup of Scrollify, but I want it to work only on pc. On mobile, I want a basic scroll.
<script>
$(function() {
$.scrollify({
section : ".scrollsection",
});
});
</script>
It's working perfectly on pc, but on the phone, it brakes the website. I want to disable it on mobile and get the normal touch scroll back.
Tried to brake Scrollify with no existing section name:
<script>
$(function() {
var windowWidth = $(window).width();
if(windowWidth > 768){
$.scrollify({ section:".scrollsection"}); }
else{
$.scrollify({ section:".not-existing-section" }); } });
</script>
It stops whole scrolling on mobile. (But if I zoom in on the website on my phone, I can scroll normally.)
Is there a way to stop scrollify.js on mobile without blocking the whole scroll?
I saw the topic:
How to disable scrollify.js on mobile
but there is no answer.

Html desktop notification with Addon Builder Firefox

I found how to show desktop notification with addon builder for firefox. Like in the below code, but how to show HTML custom notification, google chrome extension can show custom Html notification. Is that possible for Firefox, how?
Here's a typical example. When the message is clicked, a string is logged to the console.
var notifications = require("notifications");
notifications.notify({
title: "Jabberwocky",
text: "'Twas brillig, and the slithy toves",
data: "did gyre and gimble in the wabe",
onClick: function (data) {
console.log(data);
// console.log(this.data) would produce the same result.
}
});
This one displays an icon that's stored in the add-on's data directory. (See the self module documentation for more information.)
var notifications = require("notifications");
var self = require("self");
var myIconURL = self.data.url("myIcon.png");
notifications.notify({
text: "I have an icon!",
iconURL: myIconURL
});
It looks like you've found the current documentation:
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/modules/sdk/notifications.html
As stated there, (sorry) HTML content in notifications is not supported in the Add-on SDK.

Adding click event to KMLLayer Placemarks and Markers

How do i attach an onclick event to Placemarks specified in the KML file. Can event listeners be added to both google maps and google earth plugin?
How would I go about this?
In the Google Earth plugin...
google.earth.fetchKml(ge, href, function(kmlObject) {});
google.earth.addEventListener(kmlObject, 'click', function(event) {
event.preventDefault();
var kmlPlacemark = event.getTarget();
alert(kmlPlacemark.getName());
});
In Google Maps API
var ctaLayer = new google.maps.KmlLayer('http://www.****.com/index.kml');
ctaLayer.setMap(map);
google.maps.event.addListener(ctaLayer, 'click', function(kmlEvent) {
var text = kmlEvent.featureData.description;
alert(text);
});
Seemingly the onlick event is wrapped up when the kml loads (GMaps v3, kml with Placemarks) Any Placemark references to "BallonStyle" bundled in the same kml file causes these to replace the default popup - and you can achieve a lot with them.
These are the kml elements supported by Gmaps v3 http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html
If your question is how to intercept that onlick event, then I am sorry I do not know how you can achieve that.

How to use the YouTube iFrame API in Chrome and Firefox?

I have a YouTube video embedded on my site using an iFrame. I want to use the API to pause the video, but in Chrome I get an error:
Unsafe JavaScript attempt to access frame with URL http://subdomain.example.com/ from frame with URL http://www.youtube.com/embed/KmtzQCSh6xk?enablejsapi=1&origin=http://subdomain.example.com. Domains, protocols and ports must match.
In Firefox (3.6) I get this error:
Permission denied for <http://www.youtube.com> to call method Location.toString on <http://subdomain.example.com>.
I've tried putting the iFrame in myself or adding it with the API. Either way the player gets in, but I have no API control over it.
Here's the relevant part of my code:
<div id="player"></div>
<script type="text/javascript">
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '433',
width: '731',
videoId: 'KmtzQCSh6xk'
});
}
$("#pause_button").click(function(){
alert("Pausing " + player);//is undefined :(
player.pauseVideo();
});
</script>
How do I get browsers to allow the YouTube iFrame to access my page's main frame?
Thanks!
Ignore those warnings. The player should still work fine regardless.
Use the recently-introduced JavaScript Player API for iframe embeds.

Resources