Posts tagged with javascript

I'm currently trying to track form submissions on a site that has forms all over it as well as user accounts. We want to track the first form submission (a new lead) then nothing else. Because of the platform (I don't have access to the backend) it's causing every form submission to be tracked. Is there a way to limit it to user or session?

In this instance I'm wanting to fire conversion pixels for adwords and it's firing every time a form is filled out.

I've looked at Simo's guide on this that was written 6 years ago but it doesn't seem to be working.

What I did as a stopgap is identify the most common single use form (the registration form) and use that as the conversion method. However, there are other forms that are meant to be used by logged in users that get submitted over and over again. If a non-logged-in user uses this form an account is automatically created. These are the form submissions I'm trying to track.

THE SITUATION:

I am trying to display preroll ads videos on my app.

I have two different adTagUrl.
One works fine and the preroll ad is displayed.
The other doesn't, and I get an empty VAST response instead.

I thought there may be something wrong in the code, so I recreate a basic small app taking the code from the google IMA repo example.

The results is the same. One work and the other doesn't.

THE ERROR:

errorCode: 1009 errorMessage: "The VAST response document is empty." type: "adLoadError" 

VAST INSPECTOR:

If I check the VAST ad response using the Google Video Suite Inspector, both the adTagUrl work.

THE CODE:

The code is very straightforward, taken from the google IMA example repo:

var adsRequest = new google.ima.AdsRequest(); adsRequest.adTagUrl = 'MY_TAG_URL'; adsRequest.linearAdSlotWidth = 640; adsRequest.linearAdSlotHeight = 400; adsRequest.nonLinearAdSlotWidth = 640; adsRequest.nonLinearAdSlotHeight = 150; adsLoader.requestAds(adsRequest); 

THE QUESTION:

Why am I getting that error?

How it's possible that the adTagUrl works fine in the Vast Inspector, but it doesn't work when I request it from the code?

Unfortunately, built in GTM tag "Google Ads Conversion Tracking" doesn't support setting special Hotel properties (used in Google Hotel Ads):

'items': [{   'id': 'PARTNER_HOTEL_ID',   'start_date': 'CHECK_IN_DATE',   'end_date': 'CHECK_OUT_DATE' }] 

Official docs are here: https://support.google.com/google-ads/answer/9244174?hl=en Instructions are for gtag.js and GTM is only mentioned in an unclear way (at least for me):

If you're using Google Tag Manager, you can implement the gtag.js for Hotel Ads by using the custom HTML tagging option to add the booked hotel variables. The global site snippet should be set to run on all pages, including the confirmation pages, and the event snippet should run on the confirmation pages only. We do not recommend using the Google Ads template because it does not support all variables for hotel campaign reporting.

If I understood correctly, I should install gtag using GTM and then the tracking using gtag? It sounds weird...

When I implement a GoogleAds conversion event I recognize multiple network requests to various domains. Can someone explain what (and why) is happening here?

I got the idea of providing information about a certain event to a specific endpoint (or monitoring system -> GoogleAds) but I do not understand the different purposes of these multiple requests.

Code Example

var script = document.createElement('script'); script.src = "https://www.googletagmanager.com/gtag/js?id=AW-XYZ"; document.querySelector("head").appendChild(script); window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-XYZ'); gtag('event', 'conversion', { 'send_to': 'AW-XYZ/abc123', 'transaction_id': '123456789' }); 

Network Requests

Domain: googletagmanager.com/gtag/js?id=AW-XYZ Status: 200 Type: Script

Domain: googleads.g.doubleclick.net/pagead/... Status: 200 Type: script

Domain: googleadservices.com/pagead/... Status: 200 Type: script

Domain: googleads.g.doubleclick.net/pagead/... Status: 302 Type: gif

Domain: google.com/pagead/... Status: 302 Type: gif

Domain: google.de/pagead/... Status: 302 Type: gif