There is no further clarification in the text, but most of what you're looking for is in the quotes above.
The Target of a spell, as well as it's Area of Effect are both rules-defined terms.
Target or Targets: Some spells have a target or targets. You cast these spells on creatures or objects, as defined by the spell itself. You must be able to see or touch the target, and you must specifically choose that target. You do not have to select your target until you finish casting the spell.
Area: Some spells affect an area. Sometimes a spell description specifies a specially defined area, but usually an area falls into one of the categories defined below.
Regardless of the shape of the area, you select the point where the spell originates, but otherwise you don't control which creatures or objects the spell affects. The point of origin of a spell is always a grid intersection. When determining whether a given creature is within the area of a spell, count out the distance from the point of origin in squares just as you do when moving a character or when determining the range for a ranged attack. The only difference is that instead of counting from the center of one square to the center of the next, you count from intersection to intersection.
So if you are choosing to target a creature that you can see or touch with a spell that can target creatures, that counts as an 'attack' for the purposes of invisibility. Even if the spell is (Harmless) or otherwise not an 'attack'. If you similarly target a spell with an area of effect on a square intersection that includes a creature inside it's area of effect (as defined above), that counts as an 'attack' for the purposes of invisibility. Even if the spell is (Harmless) or otherwise not an attack. Alarm, for example, breaks invisibility.
Further, the rules of invisibility do not specify casting a spell that fulfills those terms. If you cast a spell, and it is still in effect three rounds later, and an enemy enters it's existing area of effect? Your invisibility breaks. For example, if you cast obscuring mist on empty space, and an enemy enters it a few rounds later.
So grease, a spell that has a duration, would cause your invisibility to break if enemies entered it's area of effect before it's expiration. If it was an instantaneous creation spell, enemies entering the area of the spell after it's cast would not break your invisibility, as the spell would have ended and the grease remaining would be mundane. However, if you coated an object in grease, you are neither creating an area of effect nor targeting any creature, so you do not break your invisibility, even though doing so causes a foe to make a reflex save - you are not targeting any foes, nor does any area of effect of your spell(s) include a foe.
Web similarly has an area of effect and a duration. Until that duration is finished, the area of effect remains and if that area of effect 'includes a foe', which it would at the end of the action that caused the movement that placed the foe inside the aoe, your invisibility breaks. Expeditious excavation would not break your invisibility, even if you tunneled a pit and the enemy fell into it - by the time they fell into it, the spell would have ended, and the spell never included them in an aoe or targeted them. The exception to this is if you targeted a square of dirt with a earth gliding foe inside it, or targeted a square with them in it in some other manner.
Note that strict definitions of this type are often ignored in actual play, as GMs tend to use logic to define 'direct' and 'indirect' harm that doesn't directly reference the specific rules terms.
There may be forum posts or other trivia from designers on this topic, but I do not follow the paizo forums or developers. Further, such PF dev posts often contradict rules text or display ignorance of the existing rules, making 'RAI' very hit and miss and unreliable, especially for cases like this.
In the End
Invisibility's 'ends if the character causes harm to a foe' clause has historically been the cause of a lot of contention, which is assumedly why the designers of pathfinder modified the original description in the attempt to make it clear-cut. However, ultimately, the degree of 'screwing with people while invisible' your table wishes to allow will vary based on the attitudes of the players and the GM.
Some tables believe it is a staple of the trope, and interpret the rules very liberally as regards screwing with people while invisible. Others bend rules (to the point of largely ignoring the RAW) and 'break' invisibility during actions that are, by RAW, entirely fine.
As this varies widely by table, the way in which this rule will be interpreted varies just as widely. While you could write a definitive set of rules for allowing indirect action while penalizing direct action, it would be cumbersome, and less useful than simply having a GM on the same page as you about what an invisible character can and can't do without breaking the spell (or alerting foes as to their location).