Namespace: cq-advertisement

WebComponents. cq-advertisement

Advertisement web component <cq-advertisement>.

Displays an advertisement banner as a "marker" (inside the chart, use CSS to position absolutely against the chart panel). The advertisement should contain content that can be enabled by calling CIQ.UI.Advertisement#show based on your business logic.

The advertisement will automatically adjust the height to accommodate the content (assuming overflow-y: auto)

Example

<cq-advertisement style="display: block; height: 106px;">
    <cq-close class="ciq-tight"></cq-close>
	<div class="sample ciq-show">
		<div cq-desktop="">
			<div><translate original="$1 Trades">$1 Trades</translate></div>
			<div><translate original="Use code ">Use code </translate><strong><translate original="Sample">Sample</translate></strong></div>
			<a target="_blank" href="https://yourURL?codeSample&desktop"><translate original="Click to learn more">Click to learn more</translate></a>
		</div>
		<div cq-phone="">
			<div><translate original="$1 Trades">$1 Trades</translate></div>
			<a target="_blank" href="https://yourURL?codeSample&mobile"><translate original="Click to learn more">Click to learn more</translate></a>
		</div>
	</div>
</cq-advertisement>

Methods


close()

Hides the advertisement and surpresses it for 24 hours by storing it in local storage. If the selector itself changes however then the ad will reappear.


setSleepAmount(units, unitType)

Sets the sleep time for this amount of time before re-displaying

Parameters:
Name Type Description
units Number

Units

unitType string

Unit type. Value values "minute","hour","day","week"


show( [selector] [, ignoreSleep])

Show the advertisement. This should be a div inside of the web component.

Parameters:
Name Type Argument Default Description
selector Selector <optional>

A selector. If none specified then the first div will be selected.

ignoreSleep Boolean <optional>
false

If true then ignore sleep


watchForRemoteClose( [ms])

Call this to force the advertisement to monitor the nameValueStore for updates. It will do this by polling. This is useful when running in multiple windows, do that if the advertisement is closed in one window then it will automatically close in the other windows.

Parameters:
Name Type Argument Default Description
ms Number <optional>
1000

Number of milliseconds to poll.