Posts tagged with google-ads-api

I have removed --> implementation 'com.google.android.gms:play-services-ads-identifier:11.4.0' dependency from build.gradle and also excluded it from all other dependencies present in project, but still getting com.google.android.gms:play-services-ads-identifier:17.0.0@aar in external libraries of project. I want to remove this sdk permanently but I am not able to do so, please provide me some solution for this.

I am having an issue with connecting my Google Tag Manager tag to my Google Display Ad Campaign for retargeting purposes.

The end goal is to make retargeting to website users that visited our website but did not press the contact us button, request a callback button, request a quote, etc. I have made a Google Tag as "Google Analytics Event" and it is being fired when a user clicks the buttons I mentioned earlier. Everything is working correctly with regards to the Google Tag.

Then I connected it to Google Analytics. I made this by using the same Measurement ID. So I assume that it has been connected.

Now this is where I am stuck. I am trying to connect this to my Google Display Ad Campaign. In "Linked Accounts", the Google Analytics 4 and UA is connected to Google Ads but I want my Google Display Ad Campaign to show only to users who did NOT press the contact us button, request a callback button, and request a quote button.

It would be very helpful if you can help me out regarding this issue.

Thanks, Daniel Schembri

I have set up my Google Tag Manager Tag and everything is working as it should. The Tag is being fired when a user press the contact us button, request a callback button, and request a quote. Therefore, the GTM tag is working correctly.

The problem is when I try to connect the GTM tag to Google Ads for retargeting purposes.

I have tried to follow a lot of Youtube tutorials and small online courses but nothing did work out.

It would be very much appreciated for someone to help me out.

Thank you, Daniel Schembri

I'm using OAuth2 flow to get access to a Google Ads Account. My application runs in a flask server, so I can get the authorization code from the OAuth2 flow using the the requestvariable in the flask context. First, I get the permission screen url, that redirects to "/google_ads/authorized" flask route.

auth_url = 'https://accounts.google.com/o/oauth2/auth' client_id = os.environ['CLIENT_ID'] client_secret = os.environ['CLIENT_SECRET'] redirect_uri = os.environ['REDIRECT_URI'] scope = 'https://www.googleapis.com/auth/adwords' 

In the redirected flask route I'm making a request to exchange the authorization code by the access token and refresh token.

token_url = 'https://accounts.google.com/o/oauth2/token' payload = {  "code": request.args['code'],  "client_id": client_id,  "client_secret": client_secret,  "redirect_uri": redirect_uri,  "grant_type": "authorization_code" } req = requests.post(url=token_url, data=json.dumps(payload) res = req.json() credentials = {  'access_token': res['access_token'],   'refresh_token': res['refresh_token'],   'client_id': client_id,  'client_secret': client_secret,   'expiry': '2023-06-12T18:01:59',   'scopes': ['https://www.googleapis.com/auth/adwords'] } 

Finally, I use the credentials dict to build a Credentials object, that is passed with the developer token as an argument to instantiate the GoogleAdsClient,

from google.oauth2.credentials import Credentials from google.ads.googleads.client import GoogleAdsClient developer_token = os.environ['DEVELOPER_TOKEN'] credentials=Credentials.from_authorized_user_info(creds) client = GoogleAdsClient(credentials=credentials, developer_token=developer_token) customer_service = client.get_service("CustomerService") customer_service.list_accessible_customers() 

When I try to make a request and list the available customers in the account, using customer_service.list_accessible_customers(), I got the following error:

{  "error": {    "code": 403,    "message": "The caller does not have permission",    "status": "PERMISSION_DENIED",    "details": [      {       "@type": "type.googleapis.com/google.ads.googleads.v14.errors.GoogleAdsFailure",       "errors": [      {        "errorCode": {           "authorizationError": "DEVELOPER_TOKEN_PROHIBITED"        },        "message": "Developer token is not allowed with project '685646918301'."          }        ],        "requestId": "hYMHcD_FbdI0vwYeKRrAbw"       }     ]   } } 

This method is the same method that I'm using to authenticate Google Analytics API requests. I already tried using the flow lib and I got the same error.

The client has requested the implementation of an event snippet on their website. This snippet involves adding a code snippet that sends hashed customer data for matching. Additionally, they have asked to include the parameter "{'allow_enhanced_conversions': true}" to the config line of the global site tag, which should trigger across all pages.

After implementing these changes, the resulting code looks as follows:

<head> <!-- Google tag (gtag.js) --> <script type="text/plain"  async src="https://www.googletagmanager.com/gtag/js?id=AW-12345"></script> <script type="text/plain"">     window.dataLayer = window.dataLayer || [];     function gtag(){dataLayer.push(arguments);}     gtag('js', new Date());     $(document).ready(function() {     var userEmail = $("#email").val();      gtag('set', 'user_data', {     "email": userEmail,       });     });     gtag('config', 'AW-12345', {'allow_enhanced_conversions': true});     gtag('config', 'AW-12346', {'allow_enhanced_conversions': true}); </script> 

However, the client has reported that the implementation has failed. Additionally, they have mentioned the absence of the ****"em" parameter in the Network Tab. I would appreciate assistance in resolving this issue.