Expand my Community achievements bar.

The reason why offer code doesn't render on the page

Avatar

Employee Advisor

There could be certain scenarios where you have the expected offer code in the Target response but this specific offer code is not rendering on the page.

Below is an illustration of an HTML offer code as the response from a regional mbox 'toolmbox'.

Untitled.png

In this particular situation, the HTML offer is the result of loading a remote offer code when user sends a request to Target server with the given custom mbox. However, it will not render on the page until a selector is specified in the applyOffer. For example: "selector": '#mainContainer'.

This selector actually tells Target about the place where to load the resultant offer on receiving the response successfully. The offer code in response will replace the content captured by the specified selector in applyOffer.

 

		adobe.target.getOffer({
                        "mbox": "toolmbox",
                        "params": {
                            "option": 1
                        },
                        "success": function (offer) {
                            adobe.target.applyOffer({
                                "mbox": "toolmbox",
                                "offer": offer,
                                "selector": '#mainContainer'
                            });
                        },
                        "error": function (status, error) {
                            console.log('Error', status, error);
                        }
                    });

 

In this case, the HTML offer (which is loading as the result of a remote offer code via 'toolmbox') will replace the content block with ID 'mainContainer'.

In the nutshell, if you want to render the offer code from your Target response then you should specify the selector as the place where your offer code(response) can go and sit.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies