Upload a list of customers email to Google Ads Management API
I am trying to upload a list of customers hashed email using this guide, and here's my code.
File file = new File("/customerMatchHashed.csv");
InputStreamContent mediaContent = new InputStreamContent("application/octet-stream",
new FileInputStream(file));
mediaContent.setLength(file.length());
try {
Analytics analytics = initializeAnalytics();
analytics.management().uploads().uploadData("AccountIdHere",
"UA-123456-1", "1223334444", mediaContent).execute();
} catch (GoogleJsonResponseException e) {
System.err.println("There was a service error: "
+ e.getDetails().getCode() + " : "
+ e.getDetails().getMessage());
}
I keep on running into this error.
There was a service error: 400 : Invalid custom data source ID format: xxxxx.
The error is self explanatory, but I don't know where to get this custom data source ID
from (it is supposed to be a string), as I don't see any such thing in the Google Analytics console. Similarly, the web property Id
, is also a string, but I don't see it in the console.
I would appreciate any help/guidance in where to get these two properties from.
java google-api google-analytics-api google-api-java-client
add a comment |
I am trying to upload a list of customers hashed email using this guide, and here's my code.
File file = new File("/customerMatchHashed.csv");
InputStreamContent mediaContent = new InputStreamContent("application/octet-stream",
new FileInputStream(file));
mediaContent.setLength(file.length());
try {
Analytics analytics = initializeAnalytics();
analytics.management().uploads().uploadData("AccountIdHere",
"UA-123456-1", "1223334444", mediaContent).execute();
} catch (GoogleJsonResponseException e) {
System.err.println("There was a service error: "
+ e.getDetails().getCode() + " : "
+ e.getDetails().getMessage());
}
I keep on running into this error.
There was a service error: 400 : Invalid custom data source ID format: xxxxx.
The error is self explanatory, but I don't know where to get this custom data source ID
from (it is supposed to be a string), as I don't see any such thing in the Google Analytics console. Similarly, the web property Id
, is also a string, but I don't see it in the console.
I would appreciate any help/guidance in where to get these two properties from.
java google-api google-analytics-api google-api-java-client
i think you should do a list to get back the correct id.
– DaImTo
Nov 22 '18 at 9:21
Hi @DaImTo, it still needs the webPropertyId. CustomDataSources sources = analytics.management(). customDataSources().list("accountId", "webPropertyId").execute(); com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code" : 400, "message" : "Invalid client data: Invalid argument: Property not found <tracking id:account_id: accountIdnlog_number: 1n>." }
– slk
Nov 22 '18 at 9:28
Then your account and web properties ids are wrong do a accountSummaries.list and find the account id and web proeprty id that you are looking for.
– DaImTo
Nov 22 '18 at 9:59
add a comment |
I am trying to upload a list of customers hashed email using this guide, and here's my code.
File file = new File("/customerMatchHashed.csv");
InputStreamContent mediaContent = new InputStreamContent("application/octet-stream",
new FileInputStream(file));
mediaContent.setLength(file.length());
try {
Analytics analytics = initializeAnalytics();
analytics.management().uploads().uploadData("AccountIdHere",
"UA-123456-1", "1223334444", mediaContent).execute();
} catch (GoogleJsonResponseException e) {
System.err.println("There was a service error: "
+ e.getDetails().getCode() + " : "
+ e.getDetails().getMessage());
}
I keep on running into this error.
There was a service error: 400 : Invalid custom data source ID format: xxxxx.
The error is self explanatory, but I don't know where to get this custom data source ID
from (it is supposed to be a string), as I don't see any such thing in the Google Analytics console. Similarly, the web property Id
, is also a string, but I don't see it in the console.
I would appreciate any help/guidance in where to get these two properties from.
java google-api google-analytics-api google-api-java-client
I am trying to upload a list of customers hashed email using this guide, and here's my code.
File file = new File("/customerMatchHashed.csv");
InputStreamContent mediaContent = new InputStreamContent("application/octet-stream",
new FileInputStream(file));
mediaContent.setLength(file.length());
try {
Analytics analytics = initializeAnalytics();
analytics.management().uploads().uploadData("AccountIdHere",
"UA-123456-1", "1223334444", mediaContent).execute();
} catch (GoogleJsonResponseException e) {
System.err.println("There was a service error: "
+ e.getDetails().getCode() + " : "
+ e.getDetails().getMessage());
}
I keep on running into this error.
There was a service error: 400 : Invalid custom data source ID format: xxxxx.
The error is self explanatory, but I don't know where to get this custom data source ID
from (it is supposed to be a string), as I don't see any such thing in the Google Analytics console. Similarly, the web property Id
, is also a string, but I don't see it in the console.
I would appreciate any help/guidance in where to get these two properties from.
java google-api google-analytics-api google-api-java-client
java google-api google-analytics-api google-api-java-client
edited Nov 22 '18 at 10:01
DaImTo
43.8k1159237
43.8k1159237
asked Nov 22 '18 at 9:01
slkslk
112
112
i think you should do a list to get back the correct id.
– DaImTo
Nov 22 '18 at 9:21
Hi @DaImTo, it still needs the webPropertyId. CustomDataSources sources = analytics.management(). customDataSources().list("accountId", "webPropertyId").execute(); com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code" : 400, "message" : "Invalid client data: Invalid argument: Property not found <tracking id:account_id: accountIdnlog_number: 1n>." }
– slk
Nov 22 '18 at 9:28
Then your account and web properties ids are wrong do a accountSummaries.list and find the account id and web proeprty id that you are looking for.
– DaImTo
Nov 22 '18 at 9:59
add a comment |
i think you should do a list to get back the correct id.
– DaImTo
Nov 22 '18 at 9:21
Hi @DaImTo, it still needs the webPropertyId. CustomDataSources sources = analytics.management(). customDataSources().list("accountId", "webPropertyId").execute(); com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code" : 400, "message" : "Invalid client data: Invalid argument: Property not found <tracking id:account_id: accountIdnlog_number: 1n>." }
– slk
Nov 22 '18 at 9:28
Then your account and web properties ids are wrong do a accountSummaries.list and find the account id and web proeprty id that you are looking for.
– DaImTo
Nov 22 '18 at 9:59
i think you should do a list to get back the correct id.
– DaImTo
Nov 22 '18 at 9:21
i think you should do a list to get back the correct id.
– DaImTo
Nov 22 '18 at 9:21
Hi @DaImTo, it still needs the webPropertyId. CustomDataSources sources = analytics.management(). customDataSources().list("accountId", "webPropertyId").execute(); com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code" : 400, "message" : "Invalid client data: Invalid argument: Property not found <tracking id:account_id: accountIdnlog_number: 1n>." }
– slk
Nov 22 '18 at 9:28
Hi @DaImTo, it still needs the webPropertyId. CustomDataSources sources = analytics.management(). customDataSources().list("accountId", "webPropertyId").execute(); com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code" : 400, "message" : "Invalid client data: Invalid argument: Property not found <tracking id:account_id: accountIdnlog_number: 1n>." }
– slk
Nov 22 '18 at 9:28
Then your account and web properties ids are wrong do a accountSummaries.list and find the account id and web proeprty id that you are looking for.
– DaImTo
Nov 22 '18 at 9:59
Then your account and web properties ids are wrong do a accountSummaries.list and find the account id and web proeprty id that you are looking for.
– DaImTo
Nov 22 '18 at 9:59
add a comment |
1 Answer
1
active
oldest
votes
The first thing you should do is a accountSummaries.list. This will give you a list of all the accounts that the currently authenticated user has access to.
AccountSummaries accountSummaries = service.management().accountSummaries().list().execute();
Then once you have found the account with the web property where you have set up the data import in the google analytics admin section. You can run a custom data sources list which will return all of the custom data sources set up for that account.
CustomDataSources sources = analytics.management().customDataSources().list(AccountIdFromPreviousRequest, WebpropertyIdFromPreviousReqeust).execute();
You can then use the id returned in your upload
analytics.management().uploads().uploadData(AccountIdFromFirstRequest,
WebpropertyIdFromFirstReqeust,
customDataSourcesFromPrevousRequest,
mediaContent).execute();
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427199%2fupload-a-list-of-customers-email-to-google-ads-management-api%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The first thing you should do is a accountSummaries.list. This will give you a list of all the accounts that the currently authenticated user has access to.
AccountSummaries accountSummaries = service.management().accountSummaries().list().execute();
Then once you have found the account with the web property where you have set up the data import in the google analytics admin section. You can run a custom data sources list which will return all of the custom data sources set up for that account.
CustomDataSources sources = analytics.management().customDataSources().list(AccountIdFromPreviousRequest, WebpropertyIdFromPreviousReqeust).execute();
You can then use the id returned in your upload
analytics.management().uploads().uploadData(AccountIdFromFirstRequest,
WebpropertyIdFromFirstReqeust,
customDataSourcesFromPrevousRequest,
mediaContent).execute();
add a comment |
The first thing you should do is a accountSummaries.list. This will give you a list of all the accounts that the currently authenticated user has access to.
AccountSummaries accountSummaries = service.management().accountSummaries().list().execute();
Then once you have found the account with the web property where you have set up the data import in the google analytics admin section. You can run a custom data sources list which will return all of the custom data sources set up for that account.
CustomDataSources sources = analytics.management().customDataSources().list(AccountIdFromPreviousRequest, WebpropertyIdFromPreviousReqeust).execute();
You can then use the id returned in your upload
analytics.management().uploads().uploadData(AccountIdFromFirstRequest,
WebpropertyIdFromFirstReqeust,
customDataSourcesFromPrevousRequest,
mediaContent).execute();
add a comment |
The first thing you should do is a accountSummaries.list. This will give you a list of all the accounts that the currently authenticated user has access to.
AccountSummaries accountSummaries = service.management().accountSummaries().list().execute();
Then once you have found the account with the web property where you have set up the data import in the google analytics admin section. You can run a custom data sources list which will return all of the custom data sources set up for that account.
CustomDataSources sources = analytics.management().customDataSources().list(AccountIdFromPreviousRequest, WebpropertyIdFromPreviousReqeust).execute();
You can then use the id returned in your upload
analytics.management().uploads().uploadData(AccountIdFromFirstRequest,
WebpropertyIdFromFirstReqeust,
customDataSourcesFromPrevousRequest,
mediaContent).execute();
The first thing you should do is a accountSummaries.list. This will give you a list of all the accounts that the currently authenticated user has access to.
AccountSummaries accountSummaries = service.management().accountSummaries().list().execute();
Then once you have found the account with the web property where you have set up the data import in the google analytics admin section. You can run a custom data sources list which will return all of the custom data sources set up for that account.
CustomDataSources sources = analytics.management().customDataSources().list(AccountIdFromPreviousRequest, WebpropertyIdFromPreviousReqeust).execute();
You can then use the id returned in your upload
analytics.management().uploads().uploadData(AccountIdFromFirstRequest,
WebpropertyIdFromFirstReqeust,
customDataSourcesFromPrevousRequest,
mediaContent).execute();
edited Nov 22 '18 at 10:10
answered Nov 22 '18 at 9:17
DaImToDaImTo
43.8k1159237
43.8k1159237
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427199%2fupload-a-list-of-customers-email-to-google-ads-management-api%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
i think you should do a list to get back the correct id.
– DaImTo
Nov 22 '18 at 9:21
Hi @DaImTo, it still needs the webPropertyId. CustomDataSources sources = analytics.management(). customDataSources().list("accountId", "webPropertyId").execute(); com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code" : 400, "message" : "Invalid client data: Invalid argument: Property not found <tracking id:account_id: accountIdnlog_number: 1n>." }
– slk
Nov 22 '18 at 9:28
Then your account and web properties ids are wrong do a accountSummaries.list and find the account id and web proeprty id that you are looking for.
– DaImTo
Nov 22 '18 at 9:59