Google ad manager for publishers DoubleClick > multiple sizes per slot - google-ad-manager

i know that i show ads with:
GA_googleFillSlot(AD_UNIT_NAME_300x250);
But what if i want to show either 300x250 or 300x600 in the same position but not both of them at once?
Cheers,
Karington!

Google defines ad units like this:
googletag.cmd.push(function () {
googletag.defineSlot('/1111111/BLAH_ROS_Island', [300, 250], 'div-gpt-ad-1111110-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.pubads().collapseEmptyDivs();
googletag.enableServices();
});
You can provide two units in the same definition, try it
googletag.cmd.push(function () {
googletag.defineSlot('/1111111/BLAH_ROS_Island', [[300, 600], [300, 250]], 'div-gpt-ad-1111110-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.pubads().collapseEmptyDivs();
googletag.enableServices();
});
So from
[300, 250]
to
[[300, 600], [300, 250]]

Related

in AWS cloudwatch dashboard, can i select to chart all dimensions of a metric

Say, I want to chart CPU usage metric for each pod in my system, with Podname being the dimension. Can I specify a widget in CDK like this, and expect it to get all pods in one widget:
const podcpumetric = new cloudwatch.Metric({
namespace: 'chkk',
metricName: 'CPU Metrics with podName as dimension',
period: Duration.days(1),
// dimensionsMap: {}, // not specified so that all pods are in the widget
statistic: 'maximum',
});
dashboard.addWidgets(
new GraphWidget({
title: 'Pod Cpu Usage',
width: 12,
left: [podcpumetric],
}),
);
I tried something like the above without specifying the dimension and hoping that it will get all pods' data. This does not seem to work.
I can however, declare one metric per pod, and then add it in the left array, but that doesn't seem a comprehensive solution. As I will have to update this widget, if I add a new pod in the future and want to chart its data.
I found out that this is possible. Domain is the only dimension in its dimensionSet.
const CompanyLogins = new MathExpression({
label: 'NumberOfDailyLoginsPerDomain',
expression: `SEARCH(' {namespace, Domain} MetricName="NumberOfDailyLoginsPerDomain" ', 'Maximum', 1440)`,
usingMetrics: {},
});
dashboard.addWidgets(
new GraphWidget({
title: 'Number of Logins per Domain (sum of logins by all users of the domain)',
width: 12,
view: cloudwatch.GraphWidgetView.BAR,
left: [CompanyLogins],
}),
);

Show mobile version of powerbi page in powerapps portals

We are trying to get a PowerBi report embedded in a Powerapps portal to show the mobile view of the report.
As described here, I’m testing with a report which only have mobile enabled pages.
This is the code I use to request the mobile version, as documented here.
let report = (await powerbi.get($('.portal-pbi-embedded')[0]))
let page = (await report.getPages()).find(i=>i.isActive);
console.log(await page.hasLayout(window['powerbi-client'].models.LayoutType.MobilePortrait))
// true
console.log(await report.updateSettings({layoutType: window['powerbi-client'].models.LayoutType.MobilePortrait}))
// {statusCode: 202, headers: {…}, body: undefined}
It appears that PowerBi can see that there is a mobile layout for the active page, and the updateSettings commands executes without errors, but nothing happens.
I also tried embedding the report again, where I request the mobile layout upfront, this gives the same behaviour (only showing the desktop version).
I recognized that the powerbi client version that powewrapps portals uses is a bit old (version 2.6.5). Even though that we are running the latest version of the portal that are available to us (9.3.2205.12).
Question 1: How do we show the mobile version of the report in the portal?
Question 2: Is there a way to update the powerbi client in the portal?
First Question
you should note the following (from docs):
after the report initial load, changing to report mobile layout is
supported only if mobile layout (portrait/landscape) has been set into
the initial embedding configuration object. Otherwise, you must first
call powerbi.reset(HTMLElement) to remove the iframe. Then, you have
to call powerbi.embed(...) using the same container with the mobile
layout setting defined on the embedded configuration object.
So basically, you are facing two options:
First Option - In your Configuration, use the following concept to control your visuals:
let models = window['powerbi-client'].models;
let embedConfig = {
type: 'report',
id: reportId,
embedUrl: 'https://app.powerbi.com/reportEmbed',
tokenType: models.TokenType.Embed,
accessToken: 'H4...rf',
settings: {
layoutType: models.LayoutType.Custom
customLayout: {
pageSize: {
type: models.PageSizeType.Custom,
width: 1600,
height: 1200
},
displayOption: models.DisplayOption.ActualSize,
pagesLayout: {
"ReportSection1" : {
defaultLayout: {
displayState: {
mode: models.VisualContainerDisplayMode.Hidden
}
},
visualsLayout: {
"VisualContainer1": {
x: 1,
y: 1,
z: 1,
width: 400,
height: 300,
displayState: {
mode: models.VisualContainerDisplayMode.Visible
}
},
"VisualContainer2": {
displayState: {
mode: models.VisualContainerDisplayMode.Visible
}
},
}
}
}
}
}
};
...
// Embed the report and display it within the div container.
let report = powerbi.embed(embedContainer, embedConfig);
The second option - use the reset method:
powerbi.reset(HTMLElement)
powerbi.embed(...)
Second Question
I'm not sure that I understood your question correctly, but if I did - take a look here (https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/update-settings)

Marking an address in geochart from its name

I am working on geochart.Is there any example showing how to mark a place,given only its name? I have done the same with geocoordinates,and with city names,country names with pure javascript
It depends on if Google knows where your place names are. For instance, this code will create a map with no problem of all the locations stated. Give it a try with your data and see if it plots:
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['Place', 'Popularity'],
['Statue of Liberty', 200],
['Eiffel Tower', 300],
['Big Ben', 400],
['Tokyo Tower', 500],
['Great Pyramids', 600],
['Gobi Desert', 700]
]);
var geochart = new google.visualization.GeoChart(
document.getElementById('visualization'));
geochart.draw(data, {width: 556, height: 347, displayMode: 'markers'});
}
While it looks like the Statue of Liberty didn't plot, it's on there, it's just small and pinkish

Google Visualization GeoMap with Google Analytics

Ok, so I'm really hoping someone can help me get started, I have been able to plot pies and timelines from my google analytics data via api with google visualization. I now want to extract the data from google analytics of visits and plot a geomap. This is the geomap sample code which works
google.load('visualization', '1', {packages: ['geochart']});
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['Country', 'Popularity'],
['Germany', 200],
['United States', 300],
['Brazil', 400],
['Canada', 500],
['France', 600],
['RU', 700],
['South Africa', 800]
]);
var geochart = new google.visualization.GeoChart(
document.getElementById('visualization'));
geochart.draw(data, {width: 556, height: 347});
}
google.setOnLoadCallback(drawVisualization);
but of course I want to get the var 'data' from my google analytics api into such an array and plot say the top 10 popular countries based on pageviews from the last 30 days?
I believe the following query will give me what I want
dimensions=ga:country
metrics=ga:visits
sort=-ga:visits
How do I get this into the proper format for the data variable to plot this geomap? If you can help me rewrite the var data so that it works, I could be the happiest man alive.
Thanks in advance
This function should take the data returned by Google Analytics, input it into a DataTable, and draw a GeoChart of the top 10 countries by visit count:
function drawChart(results) {
var entries = results.feed.getEntries();
var data = new google.visualization.DataTable();
data.addColumn('string', 'Country');
data.addColumn('number', 'Visits');
for (var i = 0; i < entries.length; i++) {
data.addRow([entries.getValueOf('ga:country'), parseInt(entries.getValueOf('ga:visits'))]);
}
// sort by visits, descending
var sortedRows = data.getSortedRows([{column: 1, desc: true}]);
// remove all elements after the 10th
while (sortedRows.length > 10) {
sortedRows.splice(10, 1);
}
var view = new google.visualization.DataView(data);
view.setRows(sortedRows);
var geochart = new google.visualization.GeoChart(document.getElementById('visualization'));
// draw the chart using the view
geochart.draw(view, {width: 556, height: 347});
}
You should look into using the new Google Analytics SuperProxy, it simplifies the process of getting api queries into the charts api, there are still a few bugs but very simple to setup, the youtibe video on the link below will take you through the full process. https://developers.google.com/analytics/solutions/google-analytics-super-proxy

Google chart legend will not go away

For the life of me I can't get the Google Chart Legend to NOT be shown, even though I'm specifying "NONE." (also noted here: Hiding the legend in Google Chart ).
$options = array( 'title' => 'Average Load Summary',
'titlePosition' => 'in',
'legend.position' => 'none',
'width' => 1100,
'height' => 700,
'hAxis.slantedTextAngle' => 90,
'hAxis.position' => 'out',
'pointSize' => 5,
'hAxis.title' => 'Stops');
Further, I can't get the slanted text angle to go horizontal (90 degrees), such that my entire label will be shown. Right now google adds "..." to my labels and they are at about a 45 degree angle. Finally, I also cannot get the hAxis.title or vAxis.title to be displayed, not matter what...
Thanks for any help anyone might have. This is a lineChart by the way...
Where you have this:
'legend.position' => 'none',
Try doing this:
'legend' => array('position' => 'none'),
For the other:
'hAxis' => array('title' => 'Stops', 'position' => 'out', 'slantedTextAngle' => 90),
Basically legend and hAxis accept multiple parameters, so they would each have their own array of options. There is only one parameter for something like width and height.
In javascript it would look like this:
var options = {
title: 'Average Load Summary'
,legend: {position: 'none'}
};